From df469864b1ab1e0bfaa1e843d3d0a84042604646 Mon Sep 17 00:00:00 2001 From: "Luke \"Jared\" Bennett" Date: Tue, 7 Feb 2017 18:02:49 +0000 Subject: Updated the filename regex --- spec/javascripts/dashboard_spec.js | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 spec/javascripts/dashboard_spec.js (limited to 'spec/javascripts/dashboard_spec.js') diff --git a/spec/javascripts/dashboard_spec.js b/spec/javascripts/dashboard_spec.js new file mode 100644 index 00000000000..c0bdb89ed63 --- /dev/null +++ b/spec/javascripts/dashboard_spec.js @@ -0,0 +1,37 @@ +/* eslint-disable no-new */ + +require('~/sidebar'); +require('~/lib/utils/text_utility'); + +((global) => { + describe('Dashboard', () => { + const fixtureTemplate = 'static/dashboard.html.raw'; + + function todosCountText() { + return $('.js-todos-count').text(); + } + + function triggerToggle(newCount) { + $(document).trigger('todo:toggle', newCount); + } + + preloadFixtures(fixtureTemplate); + beforeEach(() => { + loadFixtures(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); -- cgit v1.2.1