Skip to content

Instantly share code, notes, and snippets.

@IgorMinar
Created December 16, 2011 09:00
Show Gist options
  • Save IgorMinar/1485219 to your computer and use it in GitHub Desktop.
Save IgorMinar/1485219 to your computer and use it in GitHub Desktop.
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