aboutsummaryrefslogtreecommitdiffstats
path: root/test/jqLiteSpec.js
diff options
context:
space:
mode:
authorMisko Hevery2011-09-08 13:56:29 -0700
committerIgor Minar2011-10-11 11:01:45 -0700
commit4f78fd692c0ec51241476e6be9a4df06cd62fdd6 (patch)
tree91f70bb89b9c095126fbc093f51cedbac5cb0c78 /test/jqLiteSpec.js
parentdf6d2ba3266de405ad6c2f270f24569355706e76 (diff)
downloadangular.js-4f78fd692c0ec51241476e6be9a4df06cd62fdd6.tar.bz2
feat(forms): new and improved forms
Diffstat (limited to 'test/jqLiteSpec.js')
-rw-r--r--test/jqLiteSpec.js32
1 files changed, 25 insertions, 7 deletions
diff --git a/test/jqLiteSpec.js b/test/jqLiteSpec.js
index bb00ca25..28cc7b90 100644
--- a/test/jqLiteSpec.js
+++ b/test/jqLiteSpec.js
@@ -110,6 +110,7 @@ describe('jqLite', function(){
});
});
+
describe('scope', function() {
it('should retrieve scope attached to the current element', function() {
var element = jqLite('<i>foo</i>');
@@ -138,7 +139,7 @@ describe('jqLite', function(){
describe('data', function(){
- it('should set and get ande remove data', function(){
+ it('should set and get and remove data', function(){
var selected = jqLite([a, b, c]);
expect(selected.data('prop', 'value')).toEqual(selected);
@@ -158,6 +159,14 @@ describe('jqLite', function(){
expect(jqLite(b).data('prop')).toEqual(undefined);
expect(jqLite(c).data('prop')).toEqual(undefined);
});
+
+ it('should call $destroy function if element removed', function(){
+ var log = '';
+ var element = jqLite(a);
+ element.bind('$destroy', function(){log+= 'destroy;';});
+ element.remove();
+ expect(log).toEqual('destroy;');
+ });
});
@@ -242,6 +251,21 @@ describe('jqLite', function(){
var selector = jqLite([a, b]);
expect(selector.hasClass('abc')).toEqual(false);
});
+
+
+ it('should make sure that partial class is not checked as a subset', function(){
+ var selector = jqLite([a, b]);
+ selector.addClass('a');
+ selector.addClass('b');
+ selector.addClass('c');
+ expect(selector.addClass('abc')).toEqual(selector);
+ expect(selector.removeClass('abc')).toEqual(selector);
+ expect(jqLite(a).hasClass('abc')).toEqual(false);
+ expect(jqLite(b).hasClass('abc')).toEqual(false);
+ expect(jqLite(a).hasClass('a')).toEqual(true);
+ expect(jqLite(a).hasClass('b')).toEqual(true);
+ expect(jqLite(a).hasClass('c')).toEqual(true);
+ });
});
@@ -318,16 +342,10 @@ describe('jqLite', function(){
describe('removeClass', function(){
it('should allow removal of class', function(){
var selector = jqLite([a, b]);
- selector.addClass('a');
- selector.addClass('b');
- selector.addClass('c');
expect(selector.addClass('abc')).toEqual(selector);
expect(selector.removeClass('abc')).toEqual(selector);
expect(jqLite(a).hasClass('abc')).toEqual(false);
expect(jqLite(b).hasClass('abc')).toEqual(false);
- expect(jqLite(a).hasClass('a')).toEqual(true);
- expect(jqLite(a).hasClass('b')).toEqual(true);
- expect(jqLite(a).hasClass('c')).toEqual(true);
});