From 62c0e5c46091d8b98a20c31ab26e715bad574bae Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Tue, 26 Oct 2010 22:02:24 -0700 Subject: Fix failing tests for ie, and mark elements as ng-widget, ng-directive, and ng-binding --- test/CompilerSpec.js | 6 +++++- test/directivesSpec.js | 2 ++ test/scenario/dslSpec.js | 6 ++---- test/testabilityPatch.js | 12 +++++++++--- 4 files changed, 18 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/CompilerSpec.js b/test/CompilerSpec.js index 59c365e4..780fd7cb 100644 --- a/test/CompilerSpec.js +++ b/test/CompilerSpec.js @@ -46,6 +46,7 @@ describe('compiler', function(){ var init = template(e).$init; expect(log).toEqual("found"); init(); + expect(e.hasClass('ng-directive')).toEqual(true); expect(log).toEqual("found:init"); }); @@ -102,12 +103,13 @@ describe('compiler', function(){ } }); var scope = compile('beforemiddleafter'); - expect(lowercase(scope.$element[0].innerHTML)).toEqual('beforereplacedafter'); + expect(sortedHtml(scope.$element[0], true)).toEqual('
foo some baz'); + doc.append('
foo some baz'); $root.dsl.binding('bar'); expect($root.futureResult).toEqual('foo some baz'); }); diff --git a/test/testabilityPatch.js b/test/testabilityPatch.js index 5c6eaf4d..e8041ac7 100644 --- a/test/testabilityPatch.js +++ b/test/testabilityPatch.js @@ -81,7 +81,7 @@ extend(angular, { }); -function sortedHtml(element) { +function sortedHtml(element, showNgClass) { var html = ""; foreach(jqLite(element), function toString(node) { if (node.nodeName == "#text") { @@ -93,8 +93,14 @@ function sortedHtml(element) { html += '<' + node.nodeName.toLowerCase(); var attributes = node.attributes || []; var attrs = []; - if (node.className) - attrs.push(' class="' + node.className + '"'); + var className = node.className || ''; + if (!showNgClass) { + className = className.replace(/ng-[\w-]+\s*/g, ''); + } + className = trim(className); + if (className) { + attrs.push(' class="' + className + '"'); + } for(var i=0; i