Skip to content

Commit 146a2d2

Browse files
scott-fanetti-genesysbtecu
authored andcommitted
Updated tooltip tests
1 parent d73f980 commit 146a2d2

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

tests/integration/components/bs-datetimepicker-test.js

+68
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,72 @@ module('Integration | Component | bs datetimepicker', function(hooks) {
7979
await focus('input');
8080
assert.dom("td[data-day='01/04/2016']").hasClass('disabled', 'has disabled class');
8181
});
82+
83+
test('it passes through localized tooltips', async function(assert) {
84+
const tooltips = {
85+
clear: 'Localized Clear',
86+
close: 'Localized Close the picker',
87+
selectMonth: 'Localized Select Month',
88+
prevMonth: 'Localized Previous Month',
89+
nextMonth: 'Localized Next Month',
90+
selectYear: 'Localized Select Year',
91+
prevYear: 'Localized Previous Year',
92+
nextYear: 'Localized Next Year',
93+
selectDecade: 'Localized Select Decade',
94+
prevDecade: 'Localized Previous Decade',
95+
nextDecade: 'Localized Next Decade',
96+
prevCentury: 'Localized Previous Century',
97+
nextCentury: 'Localized Next Century',
98+
pickHour: 'Localized Pick Hour',
99+
incrementHour: 'Localized Increment Hour',
100+
decrementHour: 'Localized Decrement Hour',
101+
pickMinute: 'Localized Pick Minute',
102+
incrementMinute: 'Localized Increment Minute',
103+
decrementMinute: 'Localized Decrement Minute',
104+
pickSecond: 'Localized Pick Second',
105+
incrementSecond: 'Localized Increment Second',
106+
decrementSecond: 'Localized Decrement Second',
107+
togglePeriod: 'Localized Toggle Period',
108+
selectTime: 'Localized Select Time'
109+
};
110+
111+
this.set('tooltips', tooltips);
112+
113+
await render(hbs`{{bs-datetimepicker locale='es' openOnFocus='true' tooltips=tooltips}}`);
114+
await focus('input');
115+
116+
const $prevButtons = $('.datepicker .prev > span');
117+
const $nextButtons = $('.datepicker .next > span');
118+
const $datePicker = $('.datepicker .picker-switch');
119+
const $selectTime = $('.picker-switch a');
120+
const $modifyTime = $('.timepicker-picker a');
121+
const $timepickerHour= $('span.timepicker-hour');
122+
const $timepickerMinute = $('span.timepicker-minute');
123+
const $togglePeriod = $('.timepicker-picker button');
124+
125+
assert.equal(tooltips.selectTime, $selectTime.attr('title'), 'The select time tooltip is set');
126+
127+
assert.equal(tooltips.incrementHour, $modifyTime[0].title, 'Increment hour is set');
128+
assert.equal(tooltips.incrementMinute, $modifyTime[1].title, 'Increment minute is set');
129+
assert.equal(tooltips.decrementHour, $modifyTime[2].title, 'Decrement hour is set');
130+
assert.equal(tooltips.decrementMinute, $modifyTime[3].title, 'Decrement minute is set');
131+
132+
assert.equal(tooltips.togglePeriod, $togglePeriod.attr('title'), 'The toggle period tooltip is set');
133+
assert.equal(tooltips.pickHour, $timepickerHour.attr('title'), 'The hour picket tooltip is set');
134+
assert.equal(tooltips.pickMinute, $timepickerMinute.attr('title'), 'The minute picket tooltip is set');
135+
136+
assert.equal(tooltips.prevMonth, $prevButtons[0].title, 'The previous month tooltip was set');
137+
assert.equal(tooltips.prevYear, $prevButtons[1].title, 'The previous year tooltip was set');
138+
assert.equal(tooltips.prevDecade, $prevButtons[2].title, 'The previous decade tooltip was set');
139+
assert.equal(tooltips.prevCentury, $prevButtons[3].title, 'The revious century tooltip was set');
140+
141+
assert.equal(tooltips.nextMonth, $nextButtons[0].title, 'The next month tooltip was set');
142+
assert.equal(tooltips.nextYear, $nextButtons[1].title, 'The next year tooltip was set');
143+
assert.equal(tooltips.nextDecade, $nextButtons[2].title, 'The next decade tooltip was set');
144+
assert.equal(tooltips.nextCentury, $nextButtons[3].title, 'The next century tooltip was set');
145+
146+
assert.equal(tooltips.selectMonth, $datePicker[0].title, 'The previous month tooltip was set');
147+
assert.equal(tooltips.selectYear, $datePicker[1].title, 'The previous year tooltip was set');
148+
assert.equal(tooltips.selectDecade, $datePicker[2].title, 'The previous decade tooltip was set');
149+
})
82150
});

0 commit comments

Comments
 (0)