Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwinniehell <git@winniehell.de>2017-03-05 22:43:05 +0300
committerwinniehell <git@winniehell.de>2017-03-05 23:22:40 +0300
commit572f9782d5e8d6307784b61db0dfce48f5118445 (patch)
tree11b25c46733462729e4303b26b4895d983f14df0 /spec/javascripts/mini_pipeline_graph_dropdown_spec.js
parent4cd2ab52548e89cd7259cfb7ce320fdfa203fe84 (diff)
Remove .es6 from file extensions (!9241)
Diffstat (limited to 'spec/javascripts/mini_pipeline_graph_dropdown_spec.js')
-rw-r--r--spec/javascripts/mini_pipeline_graph_dropdown_spec.js51
1 files changed, 51 insertions, 0 deletions
diff --git a/spec/javascripts/mini_pipeline_graph_dropdown_spec.js b/spec/javascripts/mini_pipeline_graph_dropdown_spec.js
new file mode 100644
index 00000000000..7cdade01e00
--- /dev/null
+++ b/spec/javascripts/mini_pipeline_graph_dropdown_spec.js
@@ -0,0 +1,51 @@
+/* eslint-disable no-new */
+
+require('~/flash');
+require('~/mini_pipeline_graph_dropdown');
+
+(() => {
+ describe('Mini Pipeline Graph Dropdown', () => {
+ preloadFixtures('static/mini_dropdown_graph.html.raw');
+
+ beforeEach(() => {
+ loadFixtures('static/mini_dropdown_graph.html.raw');
+ });
+
+ describe('When is initialized', () => {
+ it('should initialize without errors when no options are given', () => {
+ const miniPipelineGraph = new window.gl.MiniPipelineGraph();
+
+ expect(miniPipelineGraph.dropdownListSelector).toEqual('.js-builds-dropdown-container');
+ });
+
+ it('should set the container as the given prop', () => {
+ const container = '.foo';
+
+ const miniPipelineGraph = new window.gl.MiniPipelineGraph({ container });
+
+ expect(miniPipelineGraph.container).toEqual(container);
+ });
+ });
+
+ describe('When dropdown is clicked', () => {
+ it('should call getBuildsList', () => {
+ const getBuildsListSpy = spyOn(gl.MiniPipelineGraph.prototype, 'getBuildsList').and.callFake(function () {});
+
+ new gl.MiniPipelineGraph({ container: '.js-builds-dropdown-tests' }).bindEvents();
+
+ document.querySelector('.js-builds-dropdown-button').click();
+
+ expect(getBuildsListSpy).toHaveBeenCalled();
+ });
+
+ it('should make a request to the endpoint provided in the html', () => {
+ const ajaxSpy = spyOn($, 'ajax').and.callFake(function () {});
+
+ new gl.MiniPipelineGraph({ container: '.js-builds-dropdown-tests' }).bindEvents();
+
+ document.querySelector('.js-builds-dropdown-button').click();
+ expect(ajaxSpy.calls.allArgs()[0][0].url).toEqual('foobar');
+ });
+ });
+ });
+})();