Total Complexity | 9 |
Complexity/F | 1 |
Lines of Code | 48 |
Function Count | 9 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import { shallowMount } from '@vue/test-utils'; |
||
2 | import 'src/module/sw-product/component/sw-product-layout-assignment'; |
||
3 | |||
4 | function createWrapper() { |
||
5 | return shallowMount(Shopware.Component.build('sw-product-layout-assignment'), { |
||
|
|||
6 | mocks: { |
||
7 | $t: key => key, |
||
8 | $tc: key => key |
||
9 | }, |
||
10 | stubs: { |
||
11 | 'sw-cms-list-item': true, |
||
12 | 'sw-button': true |
||
13 | } |
||
14 | }); |
||
15 | } |
||
16 | |||
17 | describe('module/sw-product/component/sw-product-layout-assignment', () => { |
||
18 | let wrapper; |
||
19 | |||
20 | beforeEach(() => { |
||
21 | wrapper = createWrapper(); |
||
22 | }); |
||
23 | |||
24 | afterEach(() => { |
||
25 | wrapper.destroy(); |
||
26 | }); |
||
27 | |||
28 | it('should emit an event when openLayoutModal() function is called', () => { |
||
29 | wrapper.vm.openLayoutModal(); |
||
30 | |||
31 | const pageChangeEvents = wrapper.emitted()['modal-layout-open']; |
||
32 | expect(pageChangeEvents.length).toBe(1); |
||
33 | }); |
||
34 | |||
35 | it('should emit an event when openInPageBuilder() function is called', () => { |
||
36 | wrapper.vm.openInPageBuilder(); |
||
37 | |||
38 | const pageChangeEvents = wrapper.emitted()['button-edit-click']; |
||
39 | expect(pageChangeEvents.length).toBe(1); |
||
40 | }); |
||
41 | |||
42 | it('should emit an event when onLayoutReset() function is called', () => { |
||
43 | wrapper.vm.onLayoutReset(); |
||
44 | |||
45 | const pageChangeEvents = wrapper.emitted()['button-delete-click']; |
||
46 | expect(pageChangeEvents.length).toBe(1); |
||
47 | }); |
||
48 | }); |
||
49 |
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.