From f4d338d393dabb49182d40b4fe90c4d1b51621c0 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Fri, 9 Mar 2012 00:00:05 -0800 Subject: chore(*): refactor all ng: to ng- --- test/directive/booleanAttrDirSpecs.js | 22 +++---- test/directive/formSpec.js | 6 +- test/directive/inputSpec.js | 110 +++++++++++++++++----------------- test/directive/ngBindSpec.js | 24 ++++---- test/directive/ngClassSpec.js | 40 ++++++------- test/directive/ngClickSpec.js | 6 +- test/directive/ngCloakSpec.js | 10 ++-- test/directive/ngControllerSpec.js | 10 ++-- test/directive/ngEventDirsSpec.js | 4 +- test/directive/ngIncludeSpec.js | 8 ++- test/directive/ngInitSpec.js | 6 +- test/directive/ngNonBindableSpec.js | 4 +- test/directive/ngPluralizeSpec.js | 2 +- test/directive/ngRepeatSpec.js | 42 ++++++------- test/directive/ngShowHideSpec.js | 12 ++-- test/directive/ngStyleSpec.js | 8 +-- test/directive/ngSwitchSpec.js | 10 ++-- test/directive/ngViewSpec.js | 10 ++-- test/directive/selectSpec.js | 78 ++++++++++++------------ 19 files changed, 207 insertions(+), 205 deletions(-) (limited to 'test/directive') diff --git a/test/directive/booleanAttrDirSpecs.js b/test/directive/booleanAttrDirSpecs.js index 2c47d81a..8d71c2d8 100644 --- a/test/directive/booleanAttrDirSpecs.js +++ b/test/directive/booleanAttrDirSpecs.js @@ -9,7 +9,7 @@ describe('boolean attr directives', function() { it('should bind href', inject(function($rootScope, $compile) { - element = $compile('')($rootScope) + element = $compile('')($rootScope) $rootScope.url = 'http://server' $rootScope.$digest(); expect(element.attr('href')).toEqual('http://server'); @@ -17,7 +17,7 @@ describe('boolean attr directives', function() { it('should bind disabled', inject(function($rootScope, $compile) { - element = $compile('')($rootScope) + element = $compile('')($rootScope) $rootScope.isDisabled = false; $rootScope.$digest(); expect(element.attr('disabled')).toBeFalsy(); @@ -28,7 +28,7 @@ describe('boolean attr directives', function() { it('should bind checked', inject(function($rootScope, $compile) { - element = $compile('')($rootScope) + element = $compile('')($rootScope) $rootScope.isChecked = false; $rootScope.$digest(); expect(element.attr('checked')).toBeFalsy(); @@ -39,7 +39,7 @@ describe('boolean attr directives', function() { it('should bind selected', inject(function($rootScope, $compile) { - element = $compile('')($rootScope) + element = $compile('')($rootScope) jqLite(document.body).append(element) $rootScope.isSelected=false; $rootScope.$digest(); @@ -51,7 +51,7 @@ describe('boolean attr directives', function() { it('should bind readonly', inject(function($rootScope, $compile) { - element = $compile('')($rootScope) + element = $compile('')($rootScope) $rootScope.isReadonly=false; $rootScope.$digest(); expect(element.attr('readOnly')).toBeFalsy(); @@ -62,7 +62,7 @@ describe('boolean attr directives', function() { it('should bind multiple', inject(function($rootScope, $compile) { - element = $compile('')($rootScope) + element = $compile('')($rootScope) $rootScope.isMultiple=false; $rootScope.$digest(); expect(element.attr('multiple')).toBeFalsy(); @@ -73,7 +73,7 @@ describe('boolean attr directives', function() { it('should bind src', inject(function($rootScope, $compile) { - element = $compile('
')($rootScope) + element = $compile('')($rootScope) $rootScope.url = 'http://localhost/'; $rootScope.$digest(); expect(element.attr('src')).toEqual('http://localhost/'); @@ -81,7 +81,7 @@ describe('boolean attr directives', function() { it('should bind href and merge with other attrs', inject(function($rootScope, $compile) { - element = $compile('')($rootScope); + element = $compile('')($rootScope); $rootScope.url = 'http://server'; $rootScope.rel = 'REL'; $rootScope.$digest(); @@ -92,18 +92,18 @@ describe('boolean attr directives', function() { it('should bind Text with no Bindings', inject(function($compile, $rootScope) { forEach(['checked', 'disabled', 'multiple', 'readonly', 'selected'], function(name) { - element = $compile('')($rootScope) + element = $compile('')($rootScope) $rootScope.$digest(); expect(element.attr(name)).toBe(name); dealoc(element); }); - element = $compile('')($rootScope) + element = $compile('')($rootScope) $rootScope.$digest(); expect(element.attr('src')).toEqual('some'); dealoc(element); - element = $compile('')($rootScope) + element = $compile('')($rootScope) $rootScope.$digest(); expect(element.attr('href')).toEqual('some'); dealoc(element); diff --git a/test/directive/formSpec.js b/test/directive/formSpec.js index 6387241f..6559da5d 100644 --- a/test/directive/formSpec.js +++ b/test/directive/formSpec.js @@ -34,7 +34,7 @@ describe('form', function() { it('should remove the widget when element removed', function() { doc = $compile( '')(scope); var form = scope.form; @@ -150,7 +150,7 @@ describe('form', function() { it('should publish widgets', function() { - doc = jqLite(''); + doc = jqLite(''); $compile(doc)(scope); var widget = scope.form.w1; @@ -167,7 +167,7 @@ describe('form', function() { beforeEach(function() { doc = $compile( '')(scope); scope.$digest(); diff --git a/test/directive/inputSpec.js b/test/directive/inputSpec.js index 54f3f7cd..5a0c4168 100644 --- a/test/directive/inputSpec.js +++ b/test/directive/inputSpec.js @@ -204,11 +204,11 @@ describe('NgModelController', function() { }); }); -describe('ng:model', function() { +describe('ng-model', function() { it('should set css classes (ng-valid, ng-invalid, ng-pristine, ng-dirty)', inject(function($compile, $rootScope) { - var element = $compile('')($rootScope); + var element = $compile('')($rootScope); $rootScope.$digest(); expect(element).toBeValid(); @@ -260,7 +260,7 @@ describe('input', function() { it('should bind to a model', function() { - compileInput(''); + compileInput(''); scope.$apply(function() { scope.name = 'misko'; @@ -271,7 +271,7 @@ describe('input', function() { it('should call $destroy on element remove', function() { - compileInput(''); + compileInput(''); var spy = jasmine.createSpy('on destroy'); scope.$on('$destroy', spy); @@ -282,7 +282,7 @@ describe('input', function() { it('should update the model on "blur" event', function() { - compileInput(''); + compileInput(''); changeInputValueTo('adam'); expect(scope.name).toEqual('adam'); @@ -290,7 +290,7 @@ describe('input', function() { it('should update the model and trim the value', function() { - compileInput(''); + compileInput(''); changeInputValueTo(' a '); expect(scope.name).toEqual('a'); @@ -298,7 +298,7 @@ describe('input', function() { it('should allow complex reference binding', function() { - compileInput(''); + compileInput(''); scope.$apply(function() { scope.obj = { abc: { name: 'Misko'} }; @@ -307,7 +307,7 @@ describe('input', function() { }); - it('should ignore input without ng:model attr', function() { + it('should ignore input without ng-model attr', function() { compileInput(''); browserTrigger(inputElm, 'blur'); @@ -320,14 +320,14 @@ describe('input', function() { it('should report error on assignment error', function() { expect(function() { - compileInput(''); + compileInput(''); scope.$digest(); }).toThrow("Syntax Error: Token '''' is an unexpected token at column 7 of the expression [throw ''] starting at ['']."); }); it("should render as blank if null", function() { - compileInput(''); + compileInput(''); scope.$apply(function() { scope.age = null; @@ -339,7 +339,7 @@ describe('input', function() { it('should render 0 even if it is a number', function() { - compileInput(''); + compileInput(''); scope.$apply(function() { scope.value = 0; }); @@ -351,7 +351,7 @@ describe('input', function() { describe('pattern', function() { it('should validate in-lined pattern', function() { - compileInput(''); + compileInput(''); scope.$digest(); changeInputValueTo('x000-00-0000x'); @@ -372,7 +372,7 @@ describe('input', function() { it('should validate pattern from scope', function() { - compileInput(''); + compileInput(''); scope.regexp = /^\d\d\d-\d\d-\d\d\d\d$/; scope.$digest(); @@ -402,7 +402,7 @@ describe('input', function() { xit('should throw an error when scope pattern can\'t be found', function() { - compileInput(''); + compileInput(''); expect(function() { changeInputValueTo('xx'); }). toThrow('Expected fooRegexp to be a RegExp but was undefined'); @@ -413,7 +413,7 @@ describe('input', function() { describe('minlength', function() { it('should invalid shorter than given minlenght', function() { - compileInput(''); + compileInput(''); changeInputValueTo('aa'); expect(scope.value).toBeUndefined(); @@ -427,7 +427,7 @@ describe('input', function() { describe('maxlength', function() { it('should invalid shorter than given maxlenght', function() { - compileInput(''); + compileInput(''); changeInputValueTo('aaaaaaaa'); expect(scope.value).toBeUndefined(); @@ -443,7 +443,7 @@ describe('input', function() { describe('number', function() { it('should not update model if view invalid', function() { - compileInput(''); + compileInput(''); scope.$apply(function() { scope.age = 123; @@ -465,7 +465,7 @@ describe('input', function() { it('should render as blank if null', function() { - compileInput(''); + compileInput(''); scope.$apply(function() { scope.age = null; @@ -477,7 +477,7 @@ describe('input', function() { it('should come up blank when no value specified', function() { - compileInput(''); + compileInput(''); scope.$digest(); expect(inputElm.val()).toBe(''); @@ -492,7 +492,7 @@ describe('input', function() { it('should parse empty string to null', function() { - compileInput(''); + compileInput(''); scope.$apply(function() { scope.age = 10; @@ -507,7 +507,7 @@ describe('input', function() { describe('min', function() { it('should validate', function() { - compileInput(''); + compileInput(''); scope.$digest(); changeInputValueTo('1'); @@ -526,7 +526,7 @@ describe('input', function() { describe('max', function() { it('should validate', function() { - compileInput(''); + compileInput(''); scope.$digest(); changeInputValueTo('20'); @@ -545,7 +545,7 @@ describe('input', function() { describe('required', function() { it('should be valid even if value is 0', function() { - compileInput(''); + compileInput(''); changeInputValueTo('0'); expect(inputElm).toBeValid(); @@ -554,7 +554,7 @@ describe('input', function() { }); it('should be valid even if value 0 is set from model', function() { - compileInput(''); + compileInput(''); scope.$apply(function() { scope.value = 0; @@ -570,7 +570,7 @@ describe('input', function() { describe('email', function() { it('should validate e-mail', function() { - compileInput(''); + compileInput(''); var widget = scope.form.alias; changeInputValueTo('vojta@google.com'); @@ -599,7 +599,7 @@ describe('input', function() { describe('url', function() { it('should validate url', function() { - compileInput(''); + compileInput(''); var widget = scope.form.alias; changeInputValueTo('http://www.something.com'); @@ -628,9 +628,9 @@ describe('input', function() { it('should update the model', function() { compileInput( - '' + - '' + - ''); + '' + + '' + + ''); scope.$apply(function() { scope.color = 'white'; @@ -655,8 +655,8 @@ describe('input', function() { xit('should allow {{expr}} as value', function() { scope.some = 11; compileInput( - '' + - ''); + '' + + ''); browserTrigger(inputElm[0]); expect(scope.value).toBe(true); @@ -669,7 +669,7 @@ describe('input', function() { describe('checkbox', function() { - it('should ignore checkbox without ng:model attr', function() { + it('should ignore checkbox without ng-model attr', function() { compileInput(''); browserTrigger(inputElm, 'blur'); @@ -681,7 +681,7 @@ describe('input', function() { it('should format booleans', function() { - compileInput(''); + compileInput(''); scope.$apply(function() { scope.name = false; @@ -696,7 +696,7 @@ describe('input', function() { it('should support type="checkbox" with non-standard capitalization', function() { - compileInput(''); + compileInput(''); browserTrigger(inputElm, 'click'); expect(scope.checkbox).toBe(true); @@ -707,8 +707,8 @@ describe('input', function() { it('should allow custom enumeration', function() { - compileInput(''); + compileInput(''); scope.$apply(function() { scope.name = 'y'; @@ -737,7 +737,7 @@ describe('input', function() { describe('textarea', function() { it("should process textarea", function() { - compileInput(''); + compileInput(''); inputElm = formElm.find('textarea'); scope.$apply(function() { @@ -753,7 +753,7 @@ describe('input', function() { }); - it('should ignore textarea without ng:model attr', function() { + it('should ignore textarea without ng-model attr', function() { compileInput(''); inputElm = formElm.find('textarea'); @@ -766,10 +766,10 @@ describe('input', function() { }); - describe('ng:list', function() { + describe('ng-list', function() { it('should parse text into an array', function() { - compileInput(''); + compileInput(''); // model -> view scope.$apply(function() { @@ -787,7 +787,7 @@ describe('input', function() { // When the user types 'a,b' the 'a,' stage parses to ['a'] but if the // $parseModel function runs it will change to 'a', in essence preventing // the user from ever typying ','. - compileInput(''); + compileInput(''); changeInputValueTo('a '); expect(inputElm.val()).toEqual('a '); @@ -808,7 +808,7 @@ describe('input', function() { xit('should require at least one item', function() { - compileInput(''); + compileInput(''); changeInputValueTo(' , '); expect(inputElm).toBeInvalid(); @@ -816,7 +816,7 @@ describe('input', function() { it('should convert empty string to an empty array', function() { - compileInput(''); + compileInput(''); changeInputValueTo(''); expect(scope.list).toEqual([]); @@ -826,7 +826,7 @@ describe('input', function() { describe('required', function() { it('should allow bindings on required', function() { - compileInput(''); + compileInput(''); scope.$apply(function() { scope.required = false; @@ -857,7 +857,7 @@ describe('input', function() { it('should invalid initial value with bound required', function() { - compileInput(''); + compileInput(''); scope.$apply(function() { scope.required = true; @@ -868,7 +868,7 @@ describe('input', function() { it('should be $invalid but $pristine if not touched', function() { - compileInput(''); + compileInput(''); scope.$apply(function() { scope.name = ''; @@ -884,7 +884,7 @@ describe('input', function() { it('should allow empty string if not required', function() { - compileInput(''); + compileInput(''); changeInputValueTo('a'); changeInputValueTo(''); expect(scope.foo).toBe(''); @@ -892,17 +892,17 @@ describe('input', function() { it('should set $invalid when model undefined', function() { - compileInput(''); + compileInput(''); scope.$digest(); expect(inputElm).toBeInvalid(); }) }); - describe('ng:change', function() { + describe('ng-change', function() { it('should $eval expression after new value is set in the model', function() { - compileInput(''); + compileInput(''); scope.change = jasmine.createSpy('change').andCallFake(function() { expect(scope.value).toBe('new value'); @@ -913,7 +913,7 @@ describe('input', function() { }); it('should not $eval the expression if changed from model', function() { - compileInput(''); + compileInput(''); scope.change = jasmine.createSpy('change'); scope.$apply(function() { @@ -924,8 +924,8 @@ describe('input', function() { }); - it('should $eval ng:change expression on checkbox', function() { - compileInput(''); + it('should $eval ng-change expression on checkbox', function() { + compileInput(''); scope.changeFn = jasmine.createSpy('changeFn'); scope.$digest(); @@ -937,10 +937,10 @@ describe('input', function() { }); - describe('ng:model-instant', function() { + describe('ng-model-instant', function() { it('should bind keydown, change, input events', inject(function($browser) { - compileInput(''); + compileInput(''); inputElm.val('value1'); browserTrigger(inputElm, 'keydown'); diff --git a/test/directive/ngBindSpec.js b/test/directive/ngBindSpec.js index e8c07494..ddfdd53d 100644 --- a/test/directive/ngBindSpec.js +++ b/test/directive/ngBindSpec.js @@ -1,6 +1,6 @@ 'use strict'; -describe('ng:bind-*', function() { +describe('ng-bind-*', function() { var element; @@ -9,10 +9,10 @@ describe('ng:bind-*', function() { }); - describe('ng:bind', function() { + describe('ng-bind', function() { it('should set text', inject(function($rootScope, $compile) { - element = $compile('')($rootScope); + element = $compile('')($rootScope); expect(element.text()).toEqual(''); $rootScope.a = 'misko'; $rootScope.$digest(); @@ -21,7 +21,7 @@ describe('ng:bind-*', function() { })); it('should set text to blank if undefined', inject(function($rootScope, $compile) { - element = $compile('')($rootScope); + element = $compile('')($rootScope); $rootScope.a = 'misko'; $rootScope.$digest(); expect(element.text()).toEqual('misko'); @@ -34,14 +34,14 @@ describe('ng:bind-*', function() { })); it('should set html', inject(function($rootScope, $compile) { - element = $compile('')($rootScope); + element = $compile('')($rootScope); $rootScope.html = '