diff options
author | Chris Baumbauer <cab@cabnetworks.net> | 2019-01-22 03:00:16 +0300 |
---|---|---|
committer | Chris Baumbauer <cab@cabnetworks.net> | 2019-02-06 09:34:15 +0300 |
commit | 17bae7c797bbf0a78bf8b16e0423a40ee767bf21 (patch) | |
tree | 7972230c7b8a59661a9c0dd8e9b47ab3ee3bef0a /spec/javascripts/serverless/components/function_row_spec.js | |
parent | d0187de202d94fa445a28c347b7a54dbf09a22a8 (diff) |
Modified Knative list view to provide more details
Diffstat (limited to 'spec/javascripts/serverless/components/function_row_spec.js')
-rw-r--r-- | spec/javascripts/serverless/components/function_row_spec.js | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/javascripts/serverless/components/function_row_spec.js b/spec/javascripts/serverless/components/function_row_spec.js new file mode 100644 index 00000000000..6933a8f6c87 --- /dev/null +++ b/spec/javascripts/serverless/components/function_row_spec.js @@ -0,0 +1,33 @@ +import Vue from 'vue'; + +import functionRowComponent from '~/serverless/components/function_row.vue'; +import mountComponent from 'spec/helpers/vue_mount_component_helper'; + +import { mockServerlessFunction } from '../mock_data'; + +const createComponent = func => mountComponent(Vue.extend(functionRowComponent), { func }); + +describe('functionRowComponent', () => { + it('Parses the function details correctly', () => { + const vm = createComponent(mockServerlessFunction); + + expect(vm.$el.querySelector('b').innerHTML).toEqual(mockServerlessFunction.name); + expect(vm.$el.querySelector('span').innerHTML).toEqual(mockServerlessFunction.image); + expect(vm.$el.querySelector('time').getAttribute('data-original-title')).not.toBe(null); + expect(vm.$el.querySelector('div.url-text-field').innerHTML).toEqual( + mockServerlessFunction.url, + ); + + vm.$destroy(); + }); + + it('handles clicks correctly', () => { + const vm = createComponent(mockServerlessFunction); + + expect(vm.checkClass(vm.$el.querySelector('p'))).toBe(true); // check somewhere inside the row + expect(vm.checkClass(vm.$el.querySelector('svg'))).toBe(false); // check a button image + expect(vm.checkClass(vm.$el.querySelector('div.url-text-field'))).toBe(false); // check the url bar + + vm.$destroy(); + }); +}); |