This repository has been archived by the owner on Sep 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
/
button_ripple.spec.js
63 lines (46 loc) · 1.78 KB
/
button_ripple.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
describe('MdButtonInkRipple', function() {
beforeEach(module('material.components.button', 'material.core'));
var $element, $rootScope, $mdButtonInkRipple, $mdInkRipple;
beforeEach(inject(function(_$rootScope_, _$mdButtonInkRipple_, _$mdInkRipple_) {
$rootScope = _$rootScope_;
$mdButtonInkRipple = _$mdButtonInkRipple_;
$mdInkRipple = _$mdInkRipple_;
$element = angular.element('<button></button>');
spyOn($mdInkRipple, 'attach');
}));
it('applies the correct ripple configuration for a md-icon-button', function() {
$element.addClass('md-icon-button');
$mdButtonInkRipple.attach($rootScope, $element);
var expected = {
isMenuItem: false,
fitRipple: true,
center: true
};
expect($mdInkRipple.attach).toHaveBeenCalledWith($rootScope, $element, expected);
});
it('applies the correct ripple configuration for all other buttons', function() {
$mdButtonInkRipple.attach($rootScope, $element);
var expected = {
isMenuItem: false,
dimBackground: true
};
expect($mdInkRipple.attach).toHaveBeenCalledWith($rootScope, $element, expected);
});
it('configures the button as a menu item when it is a md-menu-item', function() {
$element.addClass('md-menu-item');
$mdButtonInkRipple.attach($rootScope, $element);
var expected = {
isMenuItem: true,
dimBackground: true
};
expect($mdInkRipple.attach).toHaveBeenCalledWith($rootScope, $element, expected);
});
it('allows ripple configuration to be overridden', function() {
$mdButtonInkRipple.attach($rootScope, $element, { dimBackground: false });
var expected = {
isMenuItem: false,
dimBackground: false
};
expect($mdInkRipple.attach).toHaveBeenCalledWith($rootScope, $element, expected);
});
});