mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Add component tests checking custom functions
- clear() - handleInput() - onEnter()
This commit is contained in:
parent
caf56ca967
commit
168278d76a
@ -56,7 +56,6 @@ describe('SearchInput.vue', () => {
|
||||
it('accepts values as a string', () => {
|
||||
propsData = { value: 'abc' }
|
||||
const wrapper = Wrapper()
|
||||
// expect(wrapper.vm._data.searchValue).toEqual('abc')
|
||||
expect(wrapper.vm.value).toEqual('abc')
|
||||
})
|
||||
|
||||
@ -76,12 +75,28 @@ describe('SearchInput.vue', () => {
|
||||
const wrapper = Wrapper()
|
||||
const select = wrapper.find('.ds-select')
|
||||
select.trigger('focus')
|
||||
const input = wrapper.find('input')
|
||||
input.setValue('Volu')
|
||||
input.trigger('keydown.esc')
|
||||
// const clearIcon = wrapper.find('.search-clear-btn')
|
||||
// clearIcon.trigger('click')
|
||||
expect(input.element.value).toBe('')
|
||||
select.element.value = 'abcd'
|
||||
select.trigger('keyup.esc')
|
||||
expect(wrapper.emitted().clear.length).toBe(1)
|
||||
})
|
||||
|
||||
it('changes the unprocessedSearchInput as the value changes', () => {
|
||||
const wrapper = Wrapper()
|
||||
const select = wrapper.find('.ds-select')
|
||||
select.trigger('focus')
|
||||
select.element.value = 'abcd'
|
||||
select.trigger('input')
|
||||
expect(wrapper.vm.unprocessedSearchInput).toBe('abcd')
|
||||
})
|
||||
|
||||
it('searches for the term when enter is pressed', async () => {
|
||||
const wrapper = Wrapper()
|
||||
const select = wrapper.find('.ds-select')
|
||||
select.trigger('focus')
|
||||
select.element.value = 'abcd'
|
||||
select.trigger('input')
|
||||
select.trigger('keyup.enter')
|
||||
await expect(wrapper.emitted().search[0]).toEqual(['abcd'])
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
:auto-reset-search="!searchValue"
|
||||
:placeholder="$t('search.placeholder')"
|
||||
:loading="pending"
|
||||
@enter="onEnter"
|
||||
@keyup.enter.native="onEnter"
|
||||
@focus.capture.native="onFocus"
|
||||
@blur.capture.native="onBlur"
|
||||
@keyup.delete.native="onDelete"
|
||||
|
||||
@ -14,7 +14,8 @@
|
||||
"test": "jest",
|
||||
"precommit": "yarn lint",
|
||||
"e2e:local": "cypress run --headed",
|
||||
"e2e:ci": "npm-run-all --parallel --race start:ci 'cypress:ci --config baseUrl=http://localhost:3000'"
|
||||
"e2e:ci": "npm-run-all --parallel --race start:ci 'cypress:ci --config baseUrl=http://localhost:3000'",
|
||||
"test:unit:debug": "node --inspect-brk ./node_modules/jest/bin/jest.js --no-cache --runInBand"
|
||||
},
|
||||
"cypress-cucumber-preprocessor": {
|
||||
"nonGlobalStepDefinitions": true
|
||||
@ -57,9 +58,9 @@
|
||||
"portal-vue": "~1.5.1",
|
||||
"string-hash": "^1.1.3",
|
||||
"tiptap": "^1.14.0",
|
||||
"tiptap-extensions": "^1.14.0",
|
||||
"v-tooltip": "~2.0.0-rc.33",
|
||||
"vue-count-to": "~1.0.13",
|
||||
"tiptap-extensions": "^1.14.0",
|
||||
"vue-izitoast": "1.1.2",
|
||||
"vue-sweetalert-icons": "~3.2.0",
|
||||
"vuex-i18n": "~1.11.0"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user