From cb10ccc44fa78b82c80afa1cb5dac2c34fdf24b7 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Fri, 10 Feb 2012 21:35:02 -0800 Subject: feat($compile): mark scope creation with ng-scope class --- test/directivesSpec.js | 6 +++--- test/service/compilerSpec.js | 9 ++++++--- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/directivesSpec.js b/test/directivesSpec.js index 45f1cffc..88e70b50 100644 --- a/test/directivesSpec.js +++ b/test/directivesSpec.js @@ -261,7 +261,7 @@ describe("directive", function() { $rootScope.$digest(); $rootScope.dynCls = 'foo'; $rootScope.$digest(); - expect(element[0].className).toBe('ui-panel ui-selected foo'); + expect(element[0].className).toBe('ui-panel ui-selected ng-scope foo'); })); @@ -269,7 +269,7 @@ describe("directive", function() { element = $compile('
')($rootScope); $rootScope.dynCls = 'panel'; $rootScope.$digest(); - expect(element[0].className).toBe('panel bar'); + expect(element[0].className).toBe('panel bar ng-scope'); })); @@ -279,7 +279,7 @@ describe("directive", function() { $rootScope.$digest(); $rootScope.dynCls = 'window'; $rootScope.$digest(); - expect(element[0].className).toBe('bar window'); + expect(element[0].className).toBe('bar ng-scope window'); })); diff --git a/test/service/compilerSpec.js b/test/service/compilerSpec.js index 02cdcefe..4de4641a 100644 --- a/test/service/compilerSpec.js +++ b/test/service/compilerSpec.js @@ -189,19 +189,21 @@ describe('$compile', function() { toEqual('
'); expect($exceptionHandler.errors[2][0]).toEqual('LinkingError'); expect(ie($exceptionHandler.errors[2][1])). - toEqual('
'); + toEqual('
'); // crazy stuff to make IE happy function ie(text) { var list = [], - parts; + parts, elementName; parts = lowercase(text). replace('<', ''). replace('>', ''). split(' '); + elementName = parts.shift(); parts.sort(); + parts.unshift(elementName); forEach(parts, function(value, key){ if (value.substring(0,3) == 'ng-') { } else { @@ -888,6 +890,7 @@ describe('$compile', function() { it('should allow creation of new scopes', inject(function($rootScope, $compile, log) { element = $compile('
')($rootScope); expect(log).toEqual('LOG; log-002-001; 002'); + expect(element.find('span').hasClass('ng-scope')).toBe(true); })); @@ -913,7 +916,7 @@ describe('$compile', function() { expect(function(){ $compile('
'); }).toThrow('Multiple directives [scopeA, scopeB] asking for new scope on: ' + - '<' + (msie < 9 ? 'DIV' : 'div') + ' class="scope-a; scope-b">'); + '<' + (msie < 9 ? 'DIV' : 'div') + ' class="scope-a; scope-b ng-scope">'); })); -- cgit v1.2.3