Skip to content
This repository was archived by the owner on Oct 5, 2019. It is now read-only.

Commit cbf54eb

Browse files
committed
e2e test for tooltip formatter
1 parent f109902 commit cbf54eb

File tree

2 files changed

+46
-32
lines changed

2 files changed

+46
-32
lines changed

e2e-tests/scenarios.js

+45-31
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,52 @@
22

33
describe('angular-bootstrap-slider', function() {
44

5-
beforeEach(function() {
6-
browser.get('test.html');
7-
});
5+
describe('tooltip', function() {
6+
var slider, handle, tooltip;
87

9-
it('should automatically redirect to /view1 when location hash/fragment is empty', function() {
10-
expect(browser.getLocationAbsUrl()).toMatch("/test.html");
11-
});
8+
beforeEach(function() {
9+
browser.get('/test.html');
10+
browser.waitForAngular();
11+
12+
slider = element(by.css('[slider-id="tooltipSlider"]'));
13+
handle = slider.element(by.css('.slider-handle.min-slider-handle'))
14+
tooltip = slider.element(by.css('.tooltip.tooltip-main'));
15+
});
16+
17+
it('should be visible on hover', function() {
18+
browser.actions().mouseMove(handle).perform();
19+
expect(tooltip.getAttribute('class')).toMatch('in');
20+
});
21+
22+
it('should have filtered text', function() {
23+
browser.actions().mouseMove(handle).perform();
24+
expect(tooltip.getText()).toBe('Current value: 0%');
25+
});
1226

1327

14-
//describe('view1', function() {
15-
//
16-
//
17-
//
18-
// it('should render view1 when user navigates to /view1', function() {
19-
// expect(element.all(by.css('[ng-view] p')).first().getText()).
20-
// toMatch(/partial for view 1/);
21-
// });
22-
//
23-
//});
24-
25-
26-
//describe('view2', function() {
27-
//
28-
// beforeEach(function() {
29-
// browser.get('index.html#/view2');
30-
// });
31-
//
32-
//
33-
// it('should render view2 when user navigates to /view2', function() {
34-
// expect(element.all(by.css('[ng-view] p')).first().getText()).
35-
// toMatch(/partial for view 2/);
36-
// });
37-
//
38-
//});
28+
describe('should refresh filtered text', function() {
29+
var suffix, relayout;
30+
31+
beforeEach(function() {
32+
suffix = element(by.model('suffix'));
33+
relayout = element(by.id('relayout-button'));
34+
suffix.clear();
35+
});
36+
37+
it('on relayout event', function() {
38+
suffix.sendKeys('aaa');
39+
relayout.click();
40+
browser.actions().mouseMove(handle).perform();
41+
expect(tooltip.getText()).toBe('Current value: 0aaa');
42+
});
43+
44+
it('on drag start', function() {
45+
suffix.sendKeys('bbb');
46+
handle.click();
47+
browser.actions().mouseMove(handle).perform();
48+
expect(tooltip.getText()).toBe('Current value: 0bbb');
49+
});
50+
});
51+
});
52+
3953
});

test.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122

123123
<label for="formatter_sufffix">Formatter suffix:</label>
124124
<input id="formatter_sufffix" type="text" ng-model="suffix" class="form-control">
125-
<button ng-click="$broadcast('slider:relayout')">Relayout</button>
125+
<button id="relayout-button" ng-click="$broadcast('slider:relayout')">Relayout</button>
126126
</p>
127127

128128
Slider with configurable tooltip<br>

0 commit comments

Comments
 (0)