Created
December 16, 2011 09:00
-
-
Save IgorMinar/1485219 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('html', function() { | |
- it('should replace element with template', inject( | |
+ iit('should replace element with template', inject( | |
function($compileProvider){ | |
$compileProvider.directive('replace', valueFn({ | |
- html: '<div class="myWidget" new="newAttr"><<CONTENT>></div>', | |
+ html: '<div class="myWidget" new="newAttr">{{foo}} <<CONTENT>></div>', | |
compile: function(element, attr){ | |
attr.$set('compile', true); | |
} | |
})); | |
}, | |
function($compile, $rootScope) { | |
- dealoc(element = $compile( | |
+ element = $compile( | |
'<div>' + | |
'<span replace class="a b c" old="oldAttr">widget content</span>' + | |
- '</div>')($rootScope)); | |
+ '</div>')($rootScope); | |
var div = element.find('div'); | |
expect(div.attr('old')).toEqual("oldAttr"); | |
expect(div.attr('new')).toEqual("newAttr"); | |
expect(div.attr('compile')).toEqual("true"); | |
expect(div.attr('class')).toEqual('a b c myWidget'); | |
+ $rootScope.foo ='bar'; | |
+ $rootScope.$digest(); | |
+ expect(sortedHtml(element)).toEqual('<div class="myWidget" new="newAttr">bar widget content<<CONTENT>></div>'); | |
} | |
)); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment