Skip to content

Commit

Permalink
fix(tests): fix the exception comparison for non enabled recognizers
Browse files Browse the repository at this point in the history
  • Loading branch information
wzr1337 committed May 20, 2015
1 parent 012f6aa commit 7c1b5ec
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions test/gestures.Spec.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
describe("A suite", function() {
it("contains spec with an expectation", function() {
'use strict';

describe('A suite', function() {
it('contains spec with an expectation', function() {
expect(true).toBe(true);
});
});

describe("Gesture recognizers validation", function() {
describe('Gesture recognizers validation', function() {

var $compile,
$rootScope;
Expand All @@ -28,32 +30,32 @@ describe("Gesture recognizers validation", function() {
$rootScope = _$rootScope_;
}));

it("should throw if no swipe recognizer is not configured and hmSwipe directive is used", function() {
it('should throw if no swipe recognizer is not configured and hmSwipe directive is used', function() {
expect(function() {
var element = $compile("<div hm-swipe='foo()'></div>")($rootScope);
$rootScope.$digest();
}).toThrow("Directive hmSwipe requires gesture recognizer [Hammer.Swipe] to be enabled");
}).toThrow(new Error('Directive hmSwipe requires gesture recognizer [Hammer.Swipe] to be enabled'));
});

it("should not throw if tap recognizer is configured and hmTap directive is used", function() {
it('should not throw if tap recognizer is configured and hmTap directive is used', function() {
var element = $compile("<div hm-tap='foo()'></div>")($rootScope);
$rootScope.$digest();
});

it("should throw if pinch recognizer is configured but disabled and hmPinch directive is used", function() {
it('should throw if pinch recognizer is configured but disabled and hmPinch directive is used', function() {
expect(function() {
var element = $compile("<div hm-pinch='foo()'></div>")($rootScope);
$rootScope.$digest();
}).toThrow("Directive hmPinch requires gesture recognizer [Hammer.Pinch] to be enabled");
}).toThrow(new Error('Directive hmPinch requires gesture recognizer [Hammer.Pinch] to be enabled'));
});

it("should not throw if rotate recognizer is configured and explicitly enabled and hmRotate directive is used", function() {
var element = $compile("<div hm-rotate='foo()'></div>")($rootScope);
it('should not throw if rotate recognizer is configured and explicitly enabled and hmRotate directive is used', function() {
var element = $compile('<div hm-rotate="foo()"></div>')($rootScope);
$rootScope.$digest();
});

it("should not throw if hmTouch directive is used (no recognizer needed)", function() {
var element = $compile("<div hm-touch='foo()'></div>")($rootScope);
it('should not throw if hmTouch directive is used (no recognizer needed)', function() {
var element = $compile('<div hm-touch="foo()"></div>')($rootScope);
$rootScope.$digest();
});
});

0 comments on commit 7c1b5ec

Please sign in to comment.