forked from shopware/shopware
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'next-5713/form-view-empty-state-is-missing' into 'master'
NEXT-5713 - form view empty state is missing See merge request shopware/6/product/platform!1900
- Loading branch information
Showing
6 changed files
with
121 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 91 additions & 0 deletions
91
...ration/Resources/app/administration/test/module/sw-cms/component/sw-cms-page-form.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
import { shallowMount, createLocalVue } from '@vue/test-utils'; | ||
import 'src/module/sw-cms/component/sw-cms-page-form'; | ||
import 'src/app/component/base/sw-card'; | ||
|
||
function createWrapper() { | ||
const localVue = createLocalVue(); | ||
|
||
localVue.directive('responsive', {}); | ||
|
||
return shallowMount(Shopware.Component.build('sw-cms-page-form'), { | ||
localVue, | ||
propsData: { | ||
page: createPageProp() | ||
}, | ||
stubs: { | ||
'sw-icon': '<div></div>', | ||
'sw-card': Shopware.Component.build('sw-card'), | ||
'sw-cms-el-config-text': '<div class="config-element">Config element</div>' | ||
}, | ||
mocks: { | ||
$tc: (value) => value | ||
}, | ||
provide: { | ||
cmsService: { | ||
getCmsBlockRegistry: () => { | ||
return {}; | ||
}, | ||
getCmsElementRegistry: () => { | ||
return { | ||
text: { | ||
configComponent: 'sw-cms-el-config-text' | ||
} | ||
}; | ||
} | ||
} | ||
} | ||
}); | ||
} | ||
|
||
function createPageProp() { | ||
// providing only bare minimum | ||
|
||
return { | ||
sections: [ | ||
{ | ||
blocks: [] | ||
}, | ||
{ | ||
blocks: [ | ||
{ | ||
slots: [ | ||
{ | ||
type: 'text' | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
}; | ||
} | ||
|
||
describe('module/sw-cms/component/sw-cms-page-form', () => { | ||
it('should be a Vue.js component', () => { | ||
const wrapper = createWrapper(); | ||
|
||
expect(wrapper.isVueInstance()).toBeTruthy(); | ||
}); | ||
|
||
it('should have only one empty state \'card\'', () => { | ||
const wrapper = createWrapper(); | ||
const lengthOfEmptyStates = wrapper.findAll('.sw-cms-page-form__block-card.is--empty').length; | ||
|
||
|
||
expect(lengthOfEmptyStates).toBe(1); | ||
}); | ||
|
||
it('should have correct path to snippet', () => { | ||
const wrapper = createWrapper(); | ||
const textOfEmptyStateBlock = wrapper.find('.sw-cms-page-form__empty-state-text').text(); | ||
|
||
expect(textOfEmptyStateBlock).toBe('sw-cms.section.sectionEmptyState'); | ||
}); | ||
|
||
it('should have an cms section with a text element', () => { | ||
const wrapper = createWrapper(); | ||
const configElement = wrapper.find('.config-element'); | ||
|
||
expect(configElement.text()).toBe('Config element'); | ||
}); | ||
}); |