1
|
|
|
import { createLocalVue, shallowMount } from '@vue/test-utils'; |
2
|
|
|
import 'src/module/sw-settings-login-registration/page/sw-settings-login-registration'; |
3
|
|
|
import 'src/module/sw-settings/component/sw-system-config'; |
4
|
|
|
|
5
|
|
|
const classes = { |
6
|
|
|
root: 'sw-page__main-content', |
7
|
|
|
cardView: 'sw-card-view', |
8
|
|
|
systemConfig: 'sw-system-config', |
9
|
|
|
settingsCard: 'sw-card' |
10
|
|
|
}; |
11
|
|
|
|
12
|
|
|
function createWrapper() { |
13
|
|
|
Shopware.Feature.flags.FEATURE_NEXT_10555 = true; |
|
|
|
|
14
|
|
|
|
15
|
|
|
const localVue = createLocalVue(); |
16
|
|
|
|
17
|
|
|
return shallowMount(Shopware.Component.build('sw-settings-login-registration'), { |
18
|
|
|
localVue, |
19
|
|
|
mocks: { |
20
|
|
|
$tc: () => {}, |
21
|
|
|
$route: { |
22
|
|
|
meta: {} |
23
|
|
|
} |
24
|
|
|
}, |
25
|
|
|
provide: { |
26
|
|
|
feature: { |
27
|
|
|
isActive: () => true |
28
|
|
|
}, |
29
|
|
|
systemConfigApiService: { |
30
|
|
|
getConfig: () => Promise.resolve({ |
31
|
|
|
'core.systemWideLoginRegistration.isCustomerBoundToSalesChannel': true |
32
|
|
|
}) |
33
|
|
|
} |
34
|
|
|
}, |
35
|
|
|
stubs: { |
36
|
|
|
'sw-page': { |
37
|
|
|
template: ` |
38
|
|
|
<div class="sw-page"> |
39
|
|
|
<slot name="smart-bar-actions"></slot> |
40
|
|
|
<div class="sw-page__main-content"> |
41
|
|
|
<slot name="content"></slot> |
42
|
|
|
</div> |
43
|
|
|
<slot></slot> |
44
|
|
|
</div>` |
45
|
|
|
}, |
46
|
|
|
'sw-icon': true, |
47
|
|
|
'sw-card': { |
48
|
|
|
template: '<div class="sw-card"><slot></slot></div>' |
49
|
|
|
}, |
50
|
|
|
'sw-card-view': { |
51
|
|
|
template: '<div class="sw-card-view"><slot></slot></div>' |
52
|
|
|
}, |
53
|
|
|
'sw-button-process': true, |
54
|
|
|
'sw-system-config': Shopware.Component.build('sw-system-config'), |
55
|
|
|
'sw-search-bar': true, |
56
|
|
|
'sw-notification-center': true, |
57
|
|
|
'sw-loader': true |
58
|
|
|
} |
59
|
|
|
}); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
View Code Duplication |
describe('module/sw-settings-login-registration/page/sw-settings-login-registration', () => { |
|
|
|
|
63
|
|
|
let wrapper; |
64
|
|
|
|
65
|
|
|
beforeEach(() => { |
66
|
|
|
wrapper = createWrapper(); |
67
|
|
|
}); |
68
|
|
|
|
69
|
|
|
afterEach(() => { |
70
|
|
|
wrapper.destroy(); |
71
|
|
|
}); |
72
|
|
|
|
73
|
|
|
it('should be a Vue.js component', () => { |
74
|
|
|
expect(wrapper.vm).toBeTruthy(); |
75
|
|
|
}); |
76
|
|
|
|
77
|
|
|
it('should contain the settings card system', () => { |
78
|
|
|
expect( |
79
|
|
|
wrapper.find(`.${classes.root}`) |
80
|
|
|
.find(`.${classes.cardView}`) |
81
|
|
|
.find(`.${classes.systemConfig}`) |
82
|
|
|
.find(`.${classes.settingsCard}`) |
83
|
|
|
.exists() |
84
|
|
|
).toBeTruthy(); |
85
|
|
|
}); |
86
|
|
|
}); |
87
|
|
|
|
88
|
|
|
|
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.