diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2017-11-27 17:18:55 +0000 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2017-11-27 17:28:33 +0000 |
commit | 074fcb56bb21f5e30711538df0c3bc6de013e21c (patch) | |
tree | b15e8e316fa86ced04ccb9e7b687c83a5358109a /spec/javascripts/clusters | |
parent | 554bf24b2a9e2964286272e690be417901cbd6e0 (diff) | |
download | gitlab-ce-074fcb56bb21f5e30711538df0c3bc6de013e21c.tar.gz |
Adds JS unit tests
Finishes tabs & table
Updates e2e tests
Diffstat (limited to 'spec/javascripts/clusters')
-rw-r--r-- | spec/javascripts/clusters/clusters_index_spec.js | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/spec/javascripts/clusters/clusters_index_spec.js b/spec/javascripts/clusters/clusters_index_spec.js index f0bc936a7d3..b8d082208a5 100644 --- a/spec/javascripts/clusters/clusters_index_spec.js +++ b/spec/javascripts/clusters/clusters_index_spec.js @@ -5,17 +5,12 @@ import { setTimeout } from 'core-js/library/web/timers'; describe('Clusters table', () => { preloadFixtures('clusters/index_cluster.html.raw'); - let ClustersClass; let mock; beforeEach(() => { loadFixtures('clusters/index_cluster.html.raw'); - ClustersClass = new ClusterTable(); mock = new MockAdapter(axios); - }); - - afterEach(() => { - ClustersClass.removeListeners(); + return new ClusterTable(); }); describe('update cluster', () => { @@ -39,11 +34,13 @@ describe('Clusters table', () => { it('shows updated state after sucessfull request', (done) => { mock.onPut().reply(200, {}, {}); const button = document.querySelector('.js-toggle-cluster-list'); - button.click(); + expect(button.classList).toContain('is-loading'); + setTimeout(() => { - expect(button.classList).toContain('is-loading'); + expect(button.classList).not.toContain('is-loading'); + expect(button.classList).not.toContain('checked'); done(); }, 0); }); @@ -53,9 +50,11 @@ describe('Clusters table', () => { const button = document.querySelector('.js-toggle-cluster-list'); button.click(); + expect(button.classList).toContain('is-loading'); setTimeout(() => { - expect(button.classList).toContain('is-loading'); + expect(button.classList).not.toContain('is-loading'); + expect(button.classList).toContain('checked'); done(); }, 0); }); |