aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorBraden Shepherdson2013-04-12 14:03:36 -0400
committerJames deBoer2013-04-30 16:56:24 -0700
commit52a55ec61895951999cb0d74e706725b965e9c9f (patch)
treeb8e53ec8b40bf07446e5bc814e556ec7d872f4ee /test
parente295eeefaa26b203cefb8b1148417e4c4f85e037 (diff)
downloadangular.js-52a55ec61895951999cb0d74e706725b965e9c9f.tar.bz2
feat(ngTap): Add a CSS class while the element is held down.
Diffstat (limited to 'test')
-rw-r--r--test/ngMobile/directive/ngClickSpec.js20
1 files changed, 19 insertions, 1 deletions
diff --git a/test/ngMobile/directive/ngClickSpec.js b/test/ngMobile/directive/ngClickSpec.js
index 2f42662d..dd7ffed0 100644
--- a/test/ngMobile/directive/ngClickSpec.js
+++ b/test/ngMobile/directive/ngClickSpec.js
@@ -82,7 +82,7 @@ describe('ngClick (mobile)', function() {
it('should not click if a touchmove comes before touchend', inject(function($rootScope, $compile, $rootElement) {
- element = $compile('<div ng-tap="tapped = true"></div>')($rootScope);
+ element = $compile('<div ng-click="tapped = true"></div>')($rootScope);
$rootElement.append(element);
$rootScope.$digest();
@@ -95,6 +95,22 @@ describe('ngClick (mobile)', function() {
expect($rootScope.tapped).toBeUndefined();
}));
+ it('should add the CSS class while the element is held down, and then remove it', inject(function($rootScope, $compile, $rootElement) {
+ element = $compile('<div ng-click="tapped = true"></div>')($rootScope);
+ $rootElement.append(element);
+ $rootScope.$digest();
+ expect($rootScope.tapped).toBeUndefined();
+
+ var CSS_CLASS = 'ng-click-active';
+
+ expect(element.hasClass(CSS_CLASS)).toBe(false);
+ browserTrigger(element, 'touchstart', 10, 10);
+ expect(element.hasClass(CSS_CLASS)).toBe(true);
+ browserTrigger(element, 'touchend', 10, 10);
+ expect(element.hasClass(CSS_CLASS)).toBe(false);
+ expect($rootScope.tapped).toBe(true);
+ }));
+
describe('the clickbuster', function() {
var element1, element2;
@@ -292,4 +308,6 @@ describe('ngClick (mobile)', function() {
expect($rootScope.event).toBeDefined();
}));
});
+
+
});