aboutsummaryrefslogtreecommitdiffstats
path: root/test/jqLiteSpec.js
diff options
context:
space:
mode:
authorJeff Cross2013-05-29 13:44:59 -0700
committerMisko Hevery2013-05-30 23:43:27 -0700
commite1a050e6b26aca4d0e6e7125d3f6c1c8fc1d92cb (patch)
treee103549e9287a389742d57f04db0cc6f65f171f8 /test/jqLiteSpec.js
parenta4b9a6aca9a0d4b1e3be2238cf549083776284ba (diff)
downloadangular.js-e1a050e6b26aca4d0e6e7125d3f6c1c8fc1d92cb.tar.bz2
fix(jqLite): Added optional name arg in removeData
jQuery's API for removeData allows a second 'name' argument to just remove the property by that name from an element's data. The absence of this argument was causing some features not to work correctly when combining multiple directives, such as ng-click, ng-show, and ng-animate.
Diffstat (limited to 'test/jqLiteSpec.js')
-rw-r--r--test/jqLiteSpec.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/jqLiteSpec.js b/test/jqLiteSpec.js
index 70c18d35..f121e1a0 100644
--- a/test/jqLiteSpec.js
+++ b/test/jqLiteSpec.js
@@ -246,6 +246,25 @@ describe('jqLite', function() {
expect(jqLite(c).data('prop')).toBeUndefined();
});
+ it('should only remove the specified value when providing a property name to removeData', function () {
+ var selected = jqLite(a);
+
+ expect(selected.data('prop1')).toBeUndefined();
+
+ selected.data('prop1', 'value');
+ selected.data('prop2', 'doublevalue');
+
+ expect(selected.data('prop1')).toBe('value');
+ expect(selected.data('prop2')).toBe('doublevalue');
+
+ selected.removeData('prop1');
+
+ expect(selected.data('prop1')).toBeUndefined();
+ expect(selected.data('prop2')).toBe('doublevalue');
+
+ selected.removeData('prop2');
+ });
+
it('should emit $destroy event if element removed via remove()', function() {
var log = '';
var element = jqLite(a);