aboutsummaryrefslogtreecommitdiffstats
path: root/test/jqLiteSpec.js
diff options
context:
space:
mode:
authorIgor Minar2012-08-10 10:24:28 -0700
committerIgor Minar2012-08-10 13:04:39 -0700
commitc0d638a94b914edc76c5532c08a47ec4e60308d4 (patch)
treeb9a8543c7dbaa987b1cb279a82cb9a125477554f /test/jqLiteSpec.js
parent054d40f338f9000cddcf7f0513af37328b88ef41 (diff)
downloadangular.js-c0d638a94b914edc76c5532c08a47ec4e60308d4.tar.bz2
test(jqLite): add missing test for $destroy event
Diffstat (limited to 'test/jqLiteSpec.js')
-rw-r--r--test/jqLiteSpec.js17
1 files changed, 16 insertions, 1 deletions
diff --git a/test/jqLiteSpec.js b/test/jqLiteSpec.js
index 406b7a5a..1a56a343 100644
--- a/test/jqLiteSpec.js
+++ b/test/jqLiteSpec.js
@@ -2,6 +2,9 @@
describe('jqLite', function() {
var scope, a, b, c;
+
+ beforeEach(module(provideLog));
+
beforeEach(function() {
a = jqLite('<div>A</div>')[0];
b = jqLite('<div>B</div>')[0];
@@ -241,7 +244,7 @@ describe('jqLite', function() {
expect(jqLite(c).data('prop')).toBeUndefined();
});
- it('should call $destroy function if element removed', function() {
+ it('should emit $destroy event if element removed via remove()', function() {
var log = '';
var element = jqLite(a);
element.bind('$destroy', function() {log+= 'destroy;';});
@@ -249,6 +252,18 @@ describe('jqLite', function() {
expect(log).toEqual('destroy;');
});
+
+ it('should emit $destroy event if an element is removed via html()', inject(function(log) {
+ var element = jqLite('<div><span>x</span></div>');
+ element.find('span').bind('$destroy', log.fn('destroyed'));
+
+ element.html('');
+
+ expect(element.html()).toBe('');
+ expect(log).toEqual('destroyed');
+ }));
+
+
it('should retrieve all data if called without params', function() {
var element = jqLite(a);
expect(element.data()).toEqual({});