Permalink
Browse files

reformatted all code to use 2 spaces for tabs. moved bootstrap code l…

…ib out of modalSpec.js because it's ugly as sin.
  • Loading branch information...
1 parent 8992f57 commit f5c9f2dab5c4fcbd0061a3cd2404383c98e15ec9 Christopher Hiller committed Aug 18, 2012
Showing with 1,299 additions and 1,274 deletions.
  1. +7 −7 grunt.js
  2. +5 −5 modules/directives/animate/animate.js
  3. +22 −22 modules/directives/animate/test/animateSpec.js
  4. +64 −64 modules/directives/codemirror/codemirror.js
  5. +105 −102 modules/directives/codemirror/test/codemirrorSpec.js
  6. +55 −56 modules/directives/currency/currency.js
  7. +81 −81 modules/directives/currency/test/currencySpec.js
  8. +4 −3 modules/directives/date/date.coffee
  9. +19 −21 modules/directives/date/test/dateSpec.coffee
  10. +16 −17 modules/directives/event/event.js
  11. +16 −14 modules/directives/event/test/eventSpec.js
  12. +6 −6 modules/directives/if/if.js
  13. +13 −13 modules/directives/if/test/ifSpec.js
  14. +35 −36 modules/directives/jq/jq.js
  15. +11 −10 modules/directives/jq/test/jqSpec.js
  16. +20 −21 modules/directives/keypress/keypress.js
  17. +4 −4 modules/directives/keypress/test/keypressSpec.js
  18. +92 −90 modules/directives/map/map.js
  19. +21 −21 modules/directives/map/test/mapSpec.js
  20. +6 −7 modules/directives/mask/mask.coffee
  21. +1 −1 modules/directives/mask/test/maskSpec.coffee
  22. +7 −7 modules/directives/modal/modal.js
  23. +14 −233 modules/directives/modal/test/modalSpec.js
  24. +2 −2 modules/directives/reset/reset.js
  25. +1 −0 modules/directives/reset/test/resetSpec.js
  26. +30 −30 modules/directives/scrollfix/scrollfix.js
  27. +31 −31 modules/directives/scrollfix/test/scrollfixSpec.js
  28. +85 −86 modules/directives/select2/select2.js
  29. +30 −31 modules/directives/showhide/showhide.js
  30. +2 −2 modules/directives/sortable/sortable.coffee
  31. +40 −40 modules/directives/tinymce/test/tinymceSpec.js
  32. +46 −47 modules/directives/tinymce/tinymce.js
  33. +6 −6 modules/directives/validate/test/validateSpec.js
  34. +4 −4 modules/directives/validate/validate.js
  35. +15 −16 modules/filters/highlight/highlight.js
  36. +17 −17 modules/filters/highlight/test/highlightSpec.js
  37. +33 −32 modules/filters/inflector/inflector.js
  38. +29 −29 modules/filters/inflector/test/inflectorSpec.js
  39. +49 −18 modules/filters/unique/test/uniqueSpec.js
  40. +12 −13 modules/filters/unique/unique.js
  41. +8 −8 templates/template.js
  42. +21 −21 templates/test/templateSpec.js
  43. +213 −0 test/lib/bootstrap/bootstrap-modal.js
  44. +1 −0 test/test-config.js
View
@@ -1,7 +1,7 @@
var testacular = require('testacular');
/*global module:false*/
-module.exports = function(grunt) {
+module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-recess');
grunt.loadNpmTasks('grunt-coffee');
@@ -69,22 +69,22 @@ module.exports = function(grunt) {
// Default task.
grunt.registerTask('default', 'coffee concat min recess:basic recess:min test');
- grunt.registerTask('server', 'start testacular server', function() {
+ grunt.registerTask('server', 'start testacular server', function () {
//Mark the task as async but never call done, so the server stays up
var done = this.async();
testacular.server.start('test/test-config.js');
});
- grunt.registerTask('test', 'run tests (make sure server task is run first)', function() {
+ grunt.registerTask('test', 'run tests (make sure server task is run first)', function () {
var done = this.async();
grunt.utils.spawn({
cmd: process.platform === 'win32' ? 'testacular-run.cmd' : 'testacular-run',
args: ['test/test-config.js']
- }, function(error, result, code) {
+ }, function (error, result, code) {
if (error) {
- grunt.warn("Make sure the testacular server is online: run `grunt server`.\n"+
- "Also make sure you have a browser open to http://localhost:8080/.\n"+
- error.stdout+error.stderr);
+ grunt.warn("Make sure the testacular server is online: run `grunt server`.\n" +
+ "Also make sure you have a browser open to http://localhost:8080/.\n" +
+ error.stdout + error.stderr);
//the testacular runner somehow modifies the files if it errors(??).
//this causes grunt's watch task to re-fire itself constantly,
//unless we wait for a sec
@@ -7,7 +7,7 @@
* class {string} the CSS class(es) to use. For example, 'ui-hide' might be an excellent alternative class.
* @example <li ng-repeat="item in items" ui-animate=" 'ui-hide' ">{{item}}</li>
*/
-angular.module('ui.directives').directive('uiAnimate', ['ui.config', '$timeout', function(uiConfig, $timeout) {
+angular.module('ui.directives').directive('uiAnimate', ['ui.config', '$timeout', function (uiConfig, $timeout) {
var options = {};
if (angular.isString(uiConfig.animate)) {
options['class'] = uiConfig.animate;
@@ -16,18 +16,18 @@ angular.module('ui.directives').directive('uiAnimate', ['ui.config', '$timeout',
}
return {
restrict: 'A', // supports using directive as element, attribute and class
- link: function($scope, element, attrs) {
+ link: function ($scope, element, attrs) {
var opts = {};
if (attrs.uiAnimate) {
opts = $scope.$eval(attrs.uiAnimate);
if (angular.isString(opts)) {
- opts = {'class': opts};
+ opts = {'class': opts};
}
}
opts = angular.extend({'class': 'ui-animate'}, options, opts);
-
+
element.addClass(opts['class']);
- $timeout(function(){
+ $timeout(function () {
element.removeClass(opts['class']);
}, 20, false);
}
@@ -1,7 +1,7 @@
/*
* sample unit testing for sample templates and implementations
-*/
-describe('uiAnimate', function() {
+ */
+describe('uiAnimate', function () {
// declare these up here to be global to all tests
var $rootScope, $compile, $timeout, uiConfig = angular.module('ui.config');
@@ -10,57 +10,57 @@ describe('uiAnimate', function() {
// inject in angular constructs. Injector knows about leading/trailing underscores and does the right thing
// otherwise, you would need to inject these into each test
- beforeEach(inject(function(_$rootScope_, _$compile_, _$timeout_) {
+ beforeEach(inject(function (_$rootScope_, _$compile_, _$timeout_) {
$rootScope = _$rootScope_;
$compile = _$compile_;
$timeout = _$timeout_;
}));
-
- afterEach(function() {
+
+ afterEach(function () {
uiConfig.value('ui.config', {});
});
-
- describe('behavior', function() {
- it('should add a ui-animate class when the dom is compiled', function() {
+
+ describe('behavior', function () {
+ it('should add a ui-animate class when the dom is compiled', function () {
var element = $compile('<div ui-animate></div>')($rootScope);
expect(element.hasClass('ui-animate')).toBeTruthy();
});
- it('should remove the ui-animate class immediately after injection', function() {
+ it('should remove the ui-animate class immediately after injection', function () {
var element = $compile('<div ui-animate></div>')($rootScope);
$timeout.flush();
expect(element.hasClass('ui-animate')).toBeFalsy();
});
});
-
- describe('options', function() {
- describe('passed', function() {
-
- it('should use a string as the class', function() {
+
+ describe('options', function () {
+ describe('passed', function () {
+
+ it('should use a string as the class', function () {
var element = $compile('<div ui-animate=" \'ui-hide\' "></div>')($rootScope);
expect(element.hasClass('ui-hide')).toBeTruthy();
});
- it('should use an object\'s class attribute as the class', function() {
+ it('should use an object\'s class attribute as the class', function () {
var element = $compile('<div ui-animate=" { \'class\' : \'ui-hide\' } "></div>')($rootScope);
expect(element.hasClass('ui-hide')).toBeTruthy();
});
-
+
});
- describe('global', function() {
+ describe('global', function () {
var uiConfig;
- beforeEach(inject(function($injector){
+ beforeEach(inject(function ($injector) {
uiConfig = $injector.get('ui.config');
}));
-
- it('should use a string as the class', function(){
+
+ it('should use a string as the class', function () {
uiConfig.animate = 'ui-hide-global';
var element = $compile('<div ui-animate></div>')($rootScope);
expect(element.hasClass('ui-hide-global')).toBeTruthy();
});
- it('should use an object\'s class attribute as the class', function() {
- uiConfig.animate = { 'class' : 'ui-hide-global' };
+ it('should use an object\'s class attribute as the class', function () {
+ uiConfig.animate = { 'class': 'ui-hide-global' };
var element = $compile('<div ui-animate></div>')($rootScope);
expect(element.hasClass('ui-hide-global')).toBeTruthy();
});
@@ -3,76 +3,76 @@
* Binds a CodeMirror widget to a <textarea> element.
*/
angular.module('ui.directives').directive('uiCodemirror', ['ui.config', '$parse', function (uiConfig, $parse) {
- 'use strict';
+ 'use strict';
- uiConfig.codemirror = uiConfig.codemirror || {};
- return {
- require: 'ngModel',
- link: function (scope, elm, attrs, ngModel) {
- // Only works on textareas
- if ( !elm.is('textarea') ) {
- throw new Error('ui-codemirror can only be applied to a textarea element');
- }
+ uiConfig.codemirror = uiConfig.codemirror || {};
+ return {
+ require: 'ngModel',
+ link: function (scope, elm, attrs, ngModel) {
+ // Only works on textareas
+ if (!elm.is('textarea')) {
+ throw new Error('ui-codemirror can only be applied to a textarea element');
+ }
- var codemirror;
- // This is the method that we use to get the value of the ui-codemirror attribute expression.
- var uiCodemirrorGet = $parse(attrs.uiCodemirror);
- // This method will be called whenever the code mirror widget content changes
- var onChangeHandler = function (ed) {
- // We only update the model if the value has changed - this helps get around a little problem where $render triggers a change despite already being inside a $apply loop.
- var newValue = ed.getValue();
- if ( newValue !== ngModel.$viewValue ) {
- ngModel.$setViewValue(newValue);
- scope.$apply();
- }
- };
- // Create and wire up a new code mirror widget (unwiring a previous one if necessary)
- var updateCodeMirror = function(options) {
- // Merge together the options from the uiConfig and the attribute itself with the onChange event above.
- options = angular.extend({}, options, uiConfig.codemirror);
+ var codemirror;
+ // This is the method that we use to get the value of the ui-codemirror attribute expression.
+ var uiCodemirrorGet = $parse(attrs.uiCodemirror);
+ // This method will be called whenever the code mirror widget content changes
+ var onChangeHandler = function (ed) {
+ // We only update the model if the value has changed - this helps get around a little problem where $render triggers a change despite already being inside a $apply loop.
+ var newValue = ed.getValue();
+ if (newValue !== ngModel.$viewValue) {
+ ngModel.$setViewValue(newValue);
+ scope.$apply();
+ }
+ };
+ // Create and wire up a new code mirror widget (unwiring a previous one if necessary)
+ var updateCodeMirror = function (options) {
+ // Merge together the options from the uiConfig and the attribute itself with the onChange event above.
+ options = angular.extend({}, options, uiConfig.codemirror);
- // We actually want to run both handlers if the user has provided their own onChange handler.
- var userOnChange = options.onChange;
- if ( userOnChange ) {
- options.onChange = function(ed) {
- onChangeHandler(ed);
- userOnChange(ed);
- };
- } else {
- options.onChange = onChangeHandler;
- }
+ // We actually want to run both handlers if the user has provided their own onChange handler.
+ var userOnChange = options.onChange;
+ if (userOnChange) {
+ options.onChange = function (ed) {
+ onChangeHandler(ed);
+ userOnChange(ed);
+ };
+ } else {
+ options.onChange = onChangeHandler;
+ }
- // If there is a codemirror widget for this element already then we need to unwire if first
- if ( codemirror ) {
- codemirror.toTextArea();
- }
- // Create the new codemirror widget
- codemirror = CodeMirror.fromTextArea(elm[0], options);
- };
+ // If there is a codemirror widget for this element already then we need to unwire if first
+ if (codemirror) {
+ codemirror.toTextArea();
+ }
+ // Create the new codemirror widget
+ codemirror = CodeMirror.fromTextArea(elm[0], options);
+ };
- // Initialize the code mirror widget
- updateCodeMirror(uiCodemirrorGet());
+ // Initialize the code mirror widget
+ updateCodeMirror(uiCodemirrorGet());
- // Now watch to see if the codemirror attribute gets updated
- scope.$watch(uiCodemirrorGet, updateCodeMirror, true);
+ // Now watch to see if the codemirror attribute gets updated
+ scope.$watch(uiCodemirrorGet, updateCodeMirror, true);
- // CodeMirror expects a string, so make sure it gets one.
- // This does not change the model.
- ngModel.$formatters.push(function(value) {
- if(angular.isUndefined(value) || value === null) {
- return '';
- }
- else if (angular.isObject(value) || angular.isArray(value)) {
- throw new Error('ui-codemirror cannot use an object or an array as a model');
- }
- return value;
- });
+ // CodeMirror expects a string, so make sure it gets one.
+ // This does not change the model.
+ ngModel.$formatters.push(function (value) {
+ if (angular.isUndefined(value) || value === null) {
+ return '';
+ }
+ else if (angular.isObject(value) || angular.isArray(value)) {
+ throw new Error('ui-codemirror cannot use an object or an array as a model');
+ }
+ return value;
+ });
- // Override the ngModelController $render method, which is what gets called when the model is updated.
- // This takes care of the synchronizing the codeMirror element with the underlying model, in the case that it is changed by something else.
- ngModel.$render = function() {
- codemirror.setValue(ngModel.$viewValue);
- };
- }
- };
+ // Override the ngModelController $render method, which is what gets called when the model is updated.
+ // This takes care of the synchronizing the codeMirror element with the underlying model, in the case that it is changed by something else.
+ ngModel.$render = function () {
+ codemirror.setValue(ngModel.$viewValue);
+ };
+ }
+ };
}]);
Oops, something went wrong.

0 comments on commit f5c9f2d

Please sign in to comment.