diff options
Diffstat (limited to 'spec/javascripts/environments/environment_actions_spec.js')
-rw-r--r-- | spec/javascripts/environments/environment_actions_spec.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/javascripts/environments/environment_actions_spec.js b/spec/javascripts/environments/environment_actions_spec.js new file mode 100644 index 00000000000..d50d45d295e --- /dev/null +++ b/spec/javascripts/environments/environment_actions_spec.js @@ -0,0 +1,36 @@ +const ActionsComponent = require('~/environments/components/environment_actions'); + +describe('Actions Component', () => { + preloadFixtures('static/environments/element.html.raw'); + + beforeEach(() => { + loadFixtures('static/environments/element.html.raw'); + }); + + it('should render a dropdown with the provided actions', () => { + const actionsMock = [ + { + name: 'bar', + play_path: 'https://gitlab.com/play', + }, + { + name: 'foo', + play_path: '#', + }, + ]; + + const component = new ActionsComponent({ + el: document.querySelector('.test-dom-element'), + propsData: { + actions: actionsMock, + }, + }); + + expect( + component.$el.querySelectorAll('.dropdown-menu li').length, + ).toEqual(actionsMock.length); + expect( + component.$el.querySelector('.dropdown-menu li a').getAttribute('href'), + ).toEqual(actionsMock[0].play_path); + }); +}); |