From 2f571a9c830df814902fbdda1e9240b36bb64e3e Mon Sep 17 00:00:00 2001
From: Matias Niemelä
Date: Thu, 16 May 2013 14:55:56 -0400
Subject: chore(ngdocs): move angular-bootstrap.js to be generated only inside
the docs and remove from the build process
---
docs/component-spec/bootstrap/bootstrapSpec.js | 157 +
docs/component-spec/bootstrap/code.html | 91 +
docs/components/angular-bootstrap.js | 227 ++
docs/components/bootstrap/bootstrap-prettify.js | 289 ++
docs/components/bootstrap/bootstrap.js | 208 +
docs/components/bootstrap/css/bootstrap.css | 3990 ++++++++++++++++++++
.../bootstrap/google-prettify/prettify.css | 30 +
.../bootstrap/google-prettify/prettify.js | 1538 ++++++++
docs/src/templates/index.html | 4 +-
9 files changed, 6532 insertions(+), 2 deletions(-)
create mode 100644 docs/component-spec/bootstrap/bootstrapSpec.js
create mode 100644 docs/component-spec/bootstrap/code.html
create mode 100644 docs/components/angular-bootstrap.js
create mode 100644 docs/components/bootstrap/bootstrap-prettify.js
create mode 100644 docs/components/bootstrap/bootstrap.js
create mode 100644 docs/components/bootstrap/css/bootstrap.css
create mode 100644 docs/components/bootstrap/google-prettify/prettify.css
create mode 100644 docs/components/bootstrap/google-prettify/prettify.js
(limited to 'docs')
diff --git a/docs/component-spec/bootstrap/bootstrapSpec.js b/docs/component-spec/bootstrap/bootstrapSpec.js
new file mode 100644
index 00000000..2c8d89fa
--- /dev/null
+++ b/docs/component-spec/bootstrap/bootstrapSpec.js
@@ -0,0 +1,157 @@
+'use strict';
+
+describe('bootstrap', function() {
+ var $compile, $rootScope, element;
+
+ function clickTab(element, index) {
+ browserTrigger(element.children().eq(0).children().eq(index));
+ }
+
+ beforeEach(module('bootstrap'));
+ beforeEach(inject(function(_$compile_, _$rootScope_) {
+ $compile = _$compile_;
+ $rootScope = _$rootScope_;
+ }));
+ beforeEach(function(){
+ function findTab(element, index) {
+ return _jQuery(element[0]).find('> .nav-tabs > li').eq(index);
+ }
+ function findTabPane(element, index) {
+ return _jQuery(element[0]).find('> .tab-content > .tab-pane').eq(index);
+ }
+
+ this.addMatchers({
+ toHaveTab: function(index, title) {
+ var tab = findTab(element, index);
+
+ this.message = function() {
+ if (tab.length) {
+ return 'Expect tab index ' + index + ' to be ' + toJson(title) + ' but was ' + toJson(tab.text());
+ } else {
+ return 'Expect tab index ' + index + ' to be ' + toJson(title) + ' but there are only ' +
+ element.children().length + ' tabs.';
+ }
+ };
+
+ return tab.length && tab.text() == title;
+ },
+
+ toHaveTabPane: function(index, title) {
+ var tabPane = findTabPane(element, index);
+
+ this.message = function() {
+ if (tabPane.length) {
+ return 'Expect tab pane index ' + index + ' to be ' + toJson(title) + ' but was ' + toJson(tabPane.text());
+ } else {
+ return 'Expect tab pane index ' + index + ' to be ' + toJson(title) + ' but there are only ' +
+ element.children().length + 'tab panes.';
+ }
+ };
+
+ return tabPane.length && tabPane.text() == title;
+ },
+
+ toHaveSelected: function(index) {
+ var tab = findTab(element, index);
+ var tabPane = findTabPane(element, index);
+
+ this.message = function() {
+ return 'Expect tab index ' + index + ' to be selected\n' +
+ ' TAB: ' + angular.mock.dump(tab) + '\n' +
+ 'TAB-PANE: ' + angular.mock.dump(tabPane);
+ };
+
+ return tabPane.hasClass('active') && tab.hasClass('active');
+ }
+ });
+ });
+
+ afterEach(function() {
+ dealoc(element);
+ });
+
+ describe('tabbable', function() {
+
+ it('should create the right structure', function() {
+ element = $compile(
+ '
' +
+ '
tab1
' +
+ '
tab2
' +
+ '
')($rootScope);
+
+ $rootScope.$apply();
+
+ expect(element).toHaveTab(0, 'first');
+ expect(element).toHaveTab(1, 'second');
+
+ expect(element).toHaveTabPane(0, 'tab1');
+ expect(element).toHaveTabPane(1, 'tab2');
+
+ expect(element).toHaveSelected(0);
+ });
+
+
+ it('should respond to tab click', function(){
+ element = $compile(
+ '' +
+ '
tab1
' +
+ '
tab2
' +
+ '
')($rootScope);
+
+ expect(element).toHaveSelected(0);
+ clickTab(element, 1);
+ expect(element).toHaveSelected(1);
+ });
+
+
+ it('should select the first tab in repeater', function() {
+ element = $compile(
+ '' +
+ '
' +
+ 'Tab content {{id}}!' +
+ '
' +
+ '
')($rootScope);
+ $rootScope.$apply();
+
+ expect(element).toHaveSelected(0);
+ });
+
+
+ describe('ngModel', function() {
+ it('should bind to model', function() {
+ $rootScope.tab = 'B';
+
+ element = $compile(
+ '' +
+ '
tab1
' +
+ '
tab2
' +
+ '
')($rootScope);
+
+ $rootScope.$apply();
+ expect(element).toHaveSelected(1);
+
+ $rootScope.tab = 'A';
+ $rootScope.$apply();
+ expect(element).toHaveSelected(0);
+
+ clickTab(element, 1);
+ expect($rootScope.tab).toEqual('B');
+ expect(element).toHaveSelected(1);
+ });
+
+
+ it('should not overwrite the model', function() {
+ $rootScope.tab = 'tab-2';
+ element = $compile(
+ '' +
+ '
' +
+ 'Tab content {{id}}!' +
+ '
' +
+ '
')($rootScope);
+ $rootScope.$apply();
+
+ expect(element).toHaveSelected(1);
+ });
+ });
+ });
+});
diff --git a/docs/component-spec/bootstrap/code.html b/docs/component-spec/bootstrap/code.html
new file mode 100644
index 00000000..e1eaa8d2
--- /dev/null
+++ b/docs/component-spec/bootstrap/code.html
@@ -0,0 +1,91 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
AngularJS is {{'working'}}
+
+
Directive: prettify
+
+ <p>Sample text here...</p>
+
+
+
+
Directive: ng-set-text
+
+
+
+
Directive: ng-html-wrap
+
+
+
Directive ng-embed-app
+
{{text}}
+
+
Bootstrap
+
+
Directive drop-down-toggle
+
+
+
Directive tabbable
+ state = {{state}}
+
+
+
+ Tab content {{id}}!
+
+
+
+
+
+
+
+ Tab content {{id}}!
+
+
+
+
+
+
+
+ Tab content {{id}}!
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/components/angular-bootstrap.js b/docs/components/angular-bootstrap.js
new file mode 100644
index 00000000..b55bd475
--- /dev/null
+++ b/docs/components/angular-bootstrap.js
@@ -0,0 +1,227 @@
+
+/*!
+ * $script.js Async loader & dependency manager
+ * https://github.com/ded/script.js
+ * (c) Dustin Diaz, Jacob Thornton 2011
+ * License: MIT
+ */
+(function (name, definition, context) {
+ if (typeof context['module'] != 'undefined' && context['module']['exports']) context['module']['exports'] = definition()
+ else if (typeof context['define'] != 'undefined' && context['define'] == 'function' && context['define']['amd']) define(name, definition)
+ else context[name] = definition()
+})('$script', function () {
+ var doc = document
+ , head = doc.getElementsByTagName('head')[0]
+ , validBase = /^https?:\/\//
+ , list = {}, ids = {}, delay = {}, scriptpath
+ , scripts = {}, s = 'string', f = false
+ , push = 'push', domContentLoaded = 'DOMContentLoaded', readyState = 'readyState'
+ , addEventListener = 'addEventListener', onreadystatechange = 'onreadystatechange'
+
+ function every(ar, fn) {
+ for (var i = 0, j = ar.length; i < j; ++i) if (!fn(ar[i])) return f
+ return 1
+ }
+ function each(ar, fn) {
+ every(ar, function(el) {
+ return !fn(el)
+ })
+ }
+
+ if (!doc[readyState] && doc[addEventListener]) {
+ doc[addEventListener](domContentLoaded, function fn() {
+ doc.removeEventListener(domContentLoaded, fn, f)
+ doc[readyState] = 'complete'
+ }, f)
+ doc[readyState] = 'loading'
+ }
+
+ function $script(paths, idOrDone, optDone) {
+ paths = paths[push] ? paths : [paths]
+ var idOrDoneIsDone = idOrDone && idOrDone.call
+ , done = idOrDoneIsDone ? idOrDone : optDone
+ , id = idOrDoneIsDone ? paths.join('') : idOrDone
+ , queue = paths.length
+ function loopFn(item) {
+ return item.call ? item() : list[item]
+ }
+ function callback() {
+ if (!--queue) {
+ list[id] = 1
+ done && done()
+ for (var dset in delay) {
+ every(dset.split('|'), loopFn) && !each(delay[dset], loopFn) && (delay[dset] = [])
+ }
+ }
+ }
+ setTimeout(function () {
+ each(paths, function (path) {
+ if (scripts[path]) {
+ id && (ids[id] = 1)
+ return scripts[path] == 2 && callback()
+ }
+ scripts[path] = 1
+ id && (ids[id] = 1)
+ create(!validBase.test(path) && scriptpath ? scriptpath + path + '.js' : path, callback)
+ })
+ }, 0)
+ return $script
+ }
+
+ function create(path, fn) {
+ var el = doc.createElement('script')
+ , loaded = f
+ el.onload = el.onerror = el[onreadystatechange] = function () {
+ if ((el[readyState] && !(/^c|loade/.test(el[readyState]))) || loaded) return;
+ el.onload = el[onreadystatechange] = null
+ loaded = 1
+ scripts[path] = 2
+ fn()
+ }
+ el.async = 1
+ el.src = path
+ head.insertBefore(el, head.firstChild)
+ }
+
+ $script.get = create
+
+ $script.order = function (scripts, id, done) {
+ (function callback(s) {
+ s = scripts.shift()
+ if (!scripts.length) $script(s, id, done)
+ else $script(s, callback)
+ }())
+ }
+
+ $script.path = function (p) {
+ scriptpath = p
+ }
+ $script.ready = function (deps, ready, req) {
+ deps = deps[push] ? deps : [deps]
+ var missing = [];
+ !each(deps, function (dep) {
+ list[dep] || missing[push](dep);
+ }) && every(deps, function (dep) {return list[dep]}) ?
+ ready() : !function (key) {
+ delay[key] = delay[key] || []
+ delay[key][push](ready)
+ req && req(missing)
+ }(deps.join('|'))
+ return $script
+ }
+ return $script
+}, this);
+
+
+/**
+ * @license AngularJS
+ * (c) 2010-2012 Google, Inc. http://angularjs.org
+ * License: MIT
+ */
+(function(window, document) {
+
+ var filename = /^(.*\/)angular-bootstrap.js(#.*)?$/,
+ scripts = document.getElementsByTagName("SCRIPT"),
+ serverPath,
+ match,
+ globalVars = {},
+ IGNORE = {
+ innerHeight: true, innerWidth: true,
+ onkeyup: true, onkeydown: true, onresize: true,
+ event: true, frames: true, external: true,
+ sessionStorage: true, clipboardData: true, localStorage: true};
+
+ for(var j = 0; j < scripts.length; j++) {
+ match = (scripts[j].src || "").match(filename);
+ if (match) {
+ serverPath = match[1];
+ }
+ }
+
+ document.write('');
+
+ $script.path(serverPath+'../');
+ $script('angularFiles', function() {
+ var index = 0,
+ scripts = angularFiles.angularSrc;
+
+ try { delete window.angularFiles; } catch(e) { window.angularFiles = undefined; }
+ // initialize the window property cache
+ for (var prop in window) {
+ if (IGNORE[prop] || prop.match(/^moz[A-Z]/)) { //skip special variables which keep on changing
+ continue;
+ }
+ try {
+ globalVars[key(prop)] = window[prop];
+ } catch(e) {} //ignore properties that throw exception when accessed (common in FF)
+ }
+
+ (function next() {
+ if (index < scripts.length) {
+ var file = scripts[index++],
+ last = index == scripts.length,
+ name = last ? 'angular' : file;
+
+ $script(file.replace(/\.js$/, ''), name, function() {
+ angularClobberTest(file);
+ next();
+ });
+ } else {
+ // empty the cache to prevent mem leaks
+ globalVars = {};
+
+ bindJQuery();
+ publishExternalAPI(window.angular);
+
+ angularInit(document, angular.bootstrap);
+ }
+ })();
+ });
+
+ function key(prop) {
+ return "ng-clobber_" + prop;
+ }
+
+ function angularClobberTest(file) {
+ var varKey, prop,
+ clobbered = {};
+
+ for (prop in window) {
+ varKey = key(prop);
+
+ if (IGNORE[prop] || prop.match(/^moz[A-Z]/)) { //skip special variables which keep on changing
+ continue;
+ } else if (!globalVars.hasOwnProperty(varKey)) {
+ //console.log('new global variable found: ', prop);
+ try {
+ globalVars[varKey] = window[prop];
+ } catch(e) {} //ignore properties that throw exception when accessed (common in FF)
+ } else if (globalVars[varKey] !== window[prop] && !isActuallyNaN(window[prop]) && prop != 'jqLite') {
+ clobbered[prop] = true;
+ console.error("Global variable clobbered by script " + file + "! Variable name: " + prop);
+ globalVars[varKey] = window[prop];
+ }
+ }
+ for (varKey in globalVars) {
+ prop = varKey.substr(11);
+ if (prop === 'event' || prop.match(/^moz[A-Z]/)) { //skip special variables which keep on changing
+ continue;
+ }
+ if (!clobbered[prop] &&
+ prop != 'event' &&
+ prop != 'jqLite' &&
+ !isActuallyNaN(globalVars[varKey]) &&
+ globalVars[varKey] !== window[prop]) {
+
+ delete globalVars[varKey];
+ console.warn("Global variable unexpectedly deleted in script " + file + "! " +
+ "Variable name: " + prop);
+ }
+ }
+
+ function isActuallyNaN(val) {
+ return (typeof val === 'number') && isNaN(val);
+ }
+ }
+})(window, document);
+
diff --git a/docs/components/bootstrap/bootstrap-prettify.js b/docs/components/bootstrap/bootstrap-prettify.js
new file mode 100644
index 00000000..a9e61d4f
--- /dev/null
+++ b/docs/components/bootstrap/bootstrap-prettify.js
@@ -0,0 +1,289 @@
+'use strict';
+
+var directive = {};
+var service = { value: {} };
+
+var DEPENDENCIES = {
+ 'angular.js': 'http://code.angularjs.org/' + angular.version.full + '/angular.min.js',
+ 'angular-resource.js': 'http://code.angularjs.org/' + angular.version.full + '/angular-resource.min.js',
+ 'angular-sanitize.js': 'http://code.angularjs.org/' + angular.version.full + '/angular-sanitize.min.js',
+ 'angular-cookies.js': 'http://code.angularjs.org/' + angular.version.full + '/angular-cookies.min.js'
+};
+
+
+function escape(text) {
+ return text.
+ replace(/\&/g, '&').
+ replace(/\/g, '>').
+ replace(/"/g, '"');
+}
+
+/**
+ * http://stackoverflow.com/questions/451486/pre-tag-loses-line-breaks-when-setting-innerhtml-in-ie
+ * http://stackoverflow.com/questions/195363/inserting-a-newline-into-a-pre-tag-ie-javascript
+ */
+function setHtmlIe8SafeWay(element, html) {
+ var newElement = angular.element('' + html + '
');
+
+ element.html('');
+ element.append(newElement.contents());
+ return element;
+}
+
+
+directive.jsFiddle = function(getEmbeddedTemplate, escape, script) {
+ return {
+ terminal: true,
+ link: function(scope, element, attr) {
+ var name = '',
+ stylesheet = '\n',
+ fields = {
+ html: '',
+ css: '',
+ js: ''
+ };
+
+ angular.forEach(attr.jsFiddle.split(' '), function(file, index) {
+ var fileType = file.split('.')[1];
+
+ if (fileType == 'html') {
+ if (index == 0) {
+ fields[fileType] +=
+ '\n' +
+ getEmbeddedTemplate(file, 2);
+ } else {
+ fields[fileType] += '\n\n\n \n' +
+ ' \n';
+ }
+ } else {
+ fields[fileType] += getEmbeddedTemplate(file) + '\n';
+ }
+ });
+
+ fields.html += '
\n';
+
+ setHtmlIe8SafeWay(element,
+ '