We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have a simple test.
I expect the value of isEditing to be false initially. Then when I click on the edit button, I now expect isEditing to be true.
isEditing
describe('LSA Edit', () => { test('Edit button is clickable', async () => { const TestComponent = defineComponent({ setup() { return { ...useLoadsheddingComposable() } } }) const wrapper = mount(TestComponent, { global: { plugins: [ createTestingPinia({ initialState: { loadshedding: { selectedSuburb: 'Province 3' } } }) ] } }) expect(wrapper.vm.isEditing).toBe(false) const wrapperSuburb = mount(SuburbSearch) const editSuburb = wrapperSuburb.find('[data-test="edit-suburb"]') await editSuburb.trigger('click') expect(wrapper.vm.isEditing).toBe(true) }) })
<div class="lsa-container" v-if="!isEditing"> <div class="lsa-suburb"> <p class="lsa-suburb__zone"> {{ selectedSuburb.name }} (Zone {{ selectedSuburb.block_number }}) </p> <p class="lsa-suburb__muni"> {{ selectedSuburb.municipality }}, {{ selectedSuburb.province }} </p> </div> <div class="lsa-options"> <UtilIcon :icon="'edit'" @click="editSuburb" data-test="edit-suburb" /> <UtilIcon :icon="'delete'" @click="deleteSuburb" /> </div> </div> <div v-if="isEditing"> <input type="text" placeholder="Add area" @input="getSuburbs()" v-model="searchQuery" data-test="suburb-input" /> <ul v-show="searchQuery.length > 0 && filteredSuburbs.length > 0"> <li v-for="suburb in filteredSuburbs" :key="suburb.id" @click="chooseSuburb(suburb)" data-test="suburb-list" > <span>{{ suburb.name }} (Zone {{ suburb.block_number }})</span> <br /> <strong> <span>{{ suburb.municipality }}, {{ suburb.province }}</span> </strong> </li> </ul> <p v-if="searchQuery.length > 2 && filteredSuburbs.length == 0"> No area found </p> </div>
export function useLoadsheddingComposable() { const isEditing = ref(false) const editSuburb = () => { console.log('Edit suburb clicked') isEditing.value = true } return { isEditing, editSuburb } }
The first assertion passed and it's false but the second fails as I am still getting Expected: true
false
Expected: true
Anything I'm doing wrong?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Subject of the issue
I have a simple test.
I expect the value of
isEditing
to be false initially. Then when I click on the edit button, I now expectisEditing
to be true.This is my template
This is my composable
The first assertion passed and it's
false
but the second fails as I am still gettingExpected: true
Anything I'm doing wrong?
The text was updated successfully, but these errors were encountered: