diff options
| author | Misko Hevery | 2010-04-07 10:29:47 -0700 | 
|---|---|---|
| committer | Misko Hevery | 2010-04-07 10:29:47 -0700 | 
| commit | 82cb18db28ea7381e5168489207bfa23c059af0c (patch) | |
| tree | b4710ab1c2c0593ca9228cbb67495846d72d696e /test | |
| parent | 0df93fd49c1687b2eddaa79faa1c0adbef82bf72 (diff) | |
| parent | ee327a1f4f75f57c2a2c6166520c092d4942ffe0 (diff) | |
| download | angular.js-82cb18db28ea7381e5168489207bfa23c059af0c.tar.bz2 | |
Merge branch 'directives' of github.com:angular/angular.js into directives
Diffstat (limited to 'test')
| -rw-r--r-- | test/BinderTest.js | 4 | ||||
| -rw-r--r-- | test/CompilerSpec.js | 4 | ||||
| -rw-r--r-- | test/directivesSpec.js | 8 | ||||
| -rw-r--r-- | test/testabilityPatch.js | 6 | ||||
| -rw-r--r-- | test/widgetsSpec.js | 6 | 
5 files changed, 17 insertions, 11 deletions
diff --git a/test/BinderTest.js b/test/BinderTest.js index 660ad78c..c792f10b 100644 --- a/test/BinderTest.js +++ b/test/BinderTest.js @@ -706,13 +706,13 @@ BinderTest.prototype.testItShouldSelectTheCorrectRadioBox = function() {    var female = jqLite(c.node[0].childNodes[0]);    var male = jqLite(c.node[0].childNodes[1]); -  female.click(); +  trigger(female, 'click');    assertEquals("female", c.scope.sex);    assertEquals(true, female[0].checked);    assertEquals(false, male[0].checked);    assertEquals("female", female.val()); -  male.click(); +  trigger(male, 'click');    assertEquals("male", c.scope.sex);    assertEquals(false, female[0].checked);    assertEquals(true, male[0].checked); diff --git a/test/CompilerSpec.js b/test/CompilerSpec.js index 9922070f..b9529e6e 100644 --- a/test/CompilerSpec.js +++ b/test/CompilerSpec.js @@ -72,7 +72,7 @@ describe('compiler', function(){      var scope = compile('<span hello="misko" stop="true"><span hello="adam"/></span>');      expect(log).toEqual("hello misko");    }); - +      it('should allow creation of templates', function(){      directives.duplicate = function(expr, element){        element.replaceWith(document.createComment("marker")); @@ -97,7 +97,7 @@ describe('compiler', function(){        if (text == 'middle') {          expect(textNode.text()).toEqual(text);          parentNode.attr('hello', text); -        textNode.text('replaced'); +        textNode[0].textContent = 'replaced';        }      });      var scope = compile('before<span>middle</span>after'); diff --git a/test/directivesSpec.js b/test/directivesSpec.js index 74aa942b..ea442d16 100644 --- a/test/directivesSpec.js +++ b/test/directivesSpec.js @@ -142,19 +142,19 @@ describe("directives", function(){    it('should ng-show', function(){      var scope = compile('<div ng-hide="hide"></div>');      scope.$eval(); -    expect(element.css('display')).toEqual(''); +    expect(isVisible(element)).toEqual(true);      scope.$set('hide', true);      scope.$eval(); -    expect(element.css('display')).toEqual('none'); +    expect(isVisible(element)).toEqual(false);    });    it('should ng-hide', function(){      var scope = compile('<div ng-show="show"></div>');      scope.$eval(); -    expect(element.css('display')).toEqual('none'); +    expect(isVisible(element)).toEqual(false);      scope.$set('show', true);      scope.$eval(); -    expect(element.css('display')).toEqual(''); +    expect(isVisible(element)).toEqual(true);    });    it('should ng-controller', function(){ diff --git a/test/testabilityPatch.js b/test/testabilityPatch.js index dc67ddec..475784ad 100644 --- a/test/testabilityPatch.js +++ b/test/testabilityPatch.js @@ -27,6 +27,12 @@ extend(angular, {  }); +function trigger(element, type) { +  var evnt = document.createEvent('MouseEvent'); +  evnt.initMouseEvent(type, true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); +  (element[0] || element).dispatchEvent(evnt); +} +  function sortedHtml(element) {    var html = "";    (function toString(node) { diff --git a/test/widgetsSpec.js b/test/widgetsSpec.js index 312a7f2b..93c7adda 100644 --- a/test/widgetsSpec.js +++ b/test/widgetsSpec.js @@ -115,10 +115,10 @@ describe("input widget", function(){    it('should type="checkbox"', function(){      compile('<input type="checkbox" name="checkbox" checked ng-change="action = true"/>');      expect(scope.checkbox).toEqual(true); -    element.click(); +    trigger(element, 'click');      expect(scope.checkbox).toEqual(false);      expect(scope.action).toEqual(true); -    element.click(); +    trigger(element, 'click');      expect(scope.checkbox).toEqual(true);    }); @@ -142,7 +142,7 @@ describe("input widget", function(){      expect(b.checked).toEqual(true);      expect(scope.clicked).not.toBeDefined(); -    jqLite(a).click(); +    trigger(a, 'click');      expect(scope.chose).toEqual('A');      expect(scope.clicked).toEqual(1);    });  | 
