gitlab-org--gitlab-foss/spec/javascripts/dashboard_spec.js.es6

40 lines
948 B
JavaScript
Raw Normal View History

2016-10-27 15:35:07 -04:00
/* eslint-disable */
2016-08-08 17:19:46 -04:00
/*= require sidebar */
/*= require jquery */
2016-10-27 16:33:16 -04:00
/*= require js.cookie */
2016-08-08 17:19:46 -04:00
/*= require lib/utils/text_utility */
((global) => {
describe('Dashboard', () => {
const fixtureTemplate = 'dashboard.html';
function todosCountText() {
return $('.js-todos-count').text();
}
function triggerToggle(newCount) {
$(document).trigger('todo:toggle', newCount);
}
fixture.preload(fixtureTemplate);
beforeEach(() => {
fixture.load(fixtureTemplate);
new global.Sidebar();
});
it('should update todos-count after receiving the todo:toggle event', () => {
triggerToggle(5);
expect(todosCountText()).toEqual('5');
});
it('should display todos-count with delimiter', () => {
triggerToggle(1000);
expect(todosCountText()).toEqual('1,000');
triggerToggle(1000000);
expect(todosCountText()).toEqual('1,000,000');
});
});
})(window.gl);