Closed
Description
Subject of the issue
It is not possible to run findAll()
without getting the deprecation notice:
finding components with `findAll` is deprecated and will be removed in the next major version. Use `findAllComponents` instead.
But it is not possible to use findAllComponents()
if the wrapper is a non-vue component.
You will receive the following error:
Error: [vue-test-utils]: You cannot chain findAllComponents off a DOM element. It can only be used on Vue Components.
at throwError (dist/js/webpack:/node_modules/@vue/test-utils/dist/vue-test-utils.js:1700:1)
at Wrapper.findAllComponents (dist/js/webpack:/node_modules/@vue/test-utils/dist/vue-test-utils.js:10529:1)
at Context.<anonymous> (dist/js/webpack:/tests/unit/tenant/tests/migration-job-list.spec.js:87:1)
at processImmediate (internal/timers.js:456:21)
Steps to reproduce
notice: I'm using mocha
and chai-should
import {createLocalVue, shallowMount} from '@vue/test-utils';
let localVue;
localVue = createLocalVue();
it("test rows of table", () => {
wrapper = shallowMount(MyComponent, {
localVue
});
const table = cardBody.find("table");
table.exists().should.equal(true);
const rows = table.findAllComponents(TableRow);
rows.length.should.equal(3);
});
Expected behaviour
const rows = table.findAllComponents(TableRow)
should return a WrapperArray
containing all TableRow
components.
OR
const rows = table.findAll(TableRow)
should return a WrapperArray
containing all TableRow
components without display a deprecation notice.
Actual behaviour
receiving an error:
Error: [vue-test-utils]: You cannot chain findAllComponents off a DOM element. It can only be used on Vue Components.
at throwError (dist/js/webpack:/node_modules/@vue/test-utils/dist/vue-test-utils.js:1700:1)
at Wrapper.findAllComponents (dist/js/webpack:/node_modules/@vue/test-utils/dist/vue-test-utils.js:10529:1)
at Context.<anonymous> (dist/js/webpack:/tests/unit/tenant/tests/migration-job-list.spec.js:87:1)
at processImmediate (internal/timers.js:456:21)
Possible Solution
Don't show deprecation notice if you're using findAll()
on non-vue component.
Metadata
Metadata
Assignees
Labels
No labels