aboutsummaryrefslogtreecommitdiffstats
path: root/test/ng
diff options
context:
space:
mode:
authorCaitlin Potter2014-01-03 11:50:53 -0500
committerCaitlin Potter2014-01-31 12:45:35 -0500
commit5ed721b9b5e95ae08450e1ae9d5202e7f3f79295 (patch)
tree51f4b0f3dcc3ed684e5f5c91edf0de2569ebedc0 /test/ng
parentc22ab5d2e28605462ba77f6c02e99efdd24338a3 (diff)
downloadangular.js-5ed721b9b5e95ae08450e1ae9d5202e7f3f79295.tar.bz2
fix($compile): retain CSS classes added in cloneAttachFn on asynchronous directives
Previously, classes added to asynchronous directive elements during the clone attach function would not persist after the node is merged with the template, prior to linking. This change corrects this behaviour and brings it in line with synchronous directives. Closes #5439 Closes #5617
Diffstat (limited to 'test/ng')
-rwxr-xr-xtest/ng/compileSpec.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js
index c37461fc..557fb85c 100755
--- a/test/ng/compileSpec.js
+++ b/test/ng/compileSpec.js
@@ -1128,6 +1128,26 @@ describe('$compile', function() {
});
+ it('should copy classes from pre-template node into linked element', function() {
+ module(function() {
+ directive('test', valueFn({
+ templateUrl: 'test.html',
+ replace: true
+ }));
+ });
+ inject(function($compile, $templateCache, $rootScope) {
+ var child;
+ $templateCache.put('test.html', '<p class="template-class">Hello</p>');
+ element = $compile('<div test></div>')($rootScope, function(node) {
+ node.addClass('clonefn-class');
+ });
+ $rootScope.$digest();
+ expect(element).toHaveClass('template-class');
+ expect(element).toHaveClass('clonefn-class');
+ });
+ });
+
+
describe('delay compile / linking functions until after template is resolved', function(){
var template;
beforeEach(module(function() {