Skip to content

Commit

Permalink
NEXT-32662 - Transition buyers experience vue 2 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
NiklasLimberg committed Jan 17, 2024
1 parent df6da23 commit 95e5eee
Show file tree
Hide file tree
Showing 53 changed files with 2,308 additions and 2,532 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import 'src/app/component/filter/sw-base-filter';
import { createLocalVue, shallowMount } from '@vue/test-utils_v2';
import { mount } from '@vue/test-utils';

async function createWrapper() {
const localVue = createLocalVue();

return shallowMount(await Shopware.Component.build('sw-base-filter'), {
localVue,
propsData: {
return mount(await wrapTestComponent('sw-base-filter', { sync: true }), {
props: {
title: 'Example Filter',
showResetButton: false,
active: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,22 @@
import 'src/app/component/filter/sw-boolean-filter';
import 'src/app/component/filter/sw-base-filter';
import 'src/app/component/form/sw-select-field';
import 'src/app/component/form/field-base/sw-block-field';
import 'src/app/component/form/field-base/sw-base-field';
import { createLocalVue, shallowMount } from '@vue/test-utils_v2';
import { mount } from '@vue/test-utils';

const { Criteria } = Shopware.Data;

async function createWrapper() {
const localVue = createLocalVue();

return shallowMount(await Shopware.Component.build('sw-boolean-filter'), {
localVue,
stubs: {
'sw-block-field': await Shopware.Component.build('sw-block-field'),
'sw-base-field': await Shopware.Component.build('sw-base-field'),
'sw-select-field': await Shopware.Component.build('sw-select-field'),
'sw-base-filter': await Shopware.Component.build('sw-base-filter'),
'sw-icon': true,
'sw-field-error': {
template: '<div></div>',
return mount(await wrapTestComponent('sw-boolean-filter', { sync: true }), {
global: {
stubs: {
'sw-block-field': await wrapTestComponent('sw-block-field', { sync: true }),
'sw-base-field': await wrapTestComponent('sw-base-field', { sync: true }),
'sw-select-field': await wrapTestComponent('sw-select-field', { sync: true }),
'sw-base-filter': await wrapTestComponent('sw-base-filter', { sync: true }),
'sw-icon': true,
'sw-field-error': {
template: '<div></div>',
},
},
},
propsData: {
props: {
filter: {
property: 'manufacturerId',
name: 'manufacturerId',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@
import 'src/app/component/filter/sw-date-filter';
import 'src/app/component/filter/sw-base-filter';
import 'src/app/component/filter/sw-range-filter';

import { shallowMount } from '@vue/test-utils_v2';
import { mount } from '@vue/test-utils';

const { Criteria } = Shopware.Data;

async function createWrapper() {
return shallowMount(await Shopware.Component.build('sw-date-filter'), {
stubs: {
'sw-base-filter': await Shopware.Component.build('sw-base-filter'),
'sw-range-filter': await Shopware.Component.build('sw-range-filter'),
'sw-single-select': true,
'sw-datepicker': {
props: ['value'],
template: `
return mount(await wrapTestComponent('sw-date-filter', { sync: true }), {
global: {
stubs: {
'sw-base-filter': await wrapTestComponent('sw-base-filter', { sync: true }),
'sw-range-filter': await wrapTestComponent('sw-range-filter', { sync: true }),
'sw-single-select': true,
'sw-datepicker': {
props: ['value'],
template: `
<div class="sw-field--datepicker">
<input type="text" ref="flatpickrInput" :value="value" @input="onChange">
</div>`,
methods: {
onChange(e) {
this.$emit('update:value', e.target.value);
methods: {
onChange(e) {
this.$emit('update:value', e.target.value);
},
},
},
},
'sw-container': {
template: '<div class="sw-container"><slot></slot></div>',
'sw-container': {
template: '<div class="sw-container"><slot></slot></div>',
},
},
},
propsData: {
props: {
filter: {
property: 'releaseDate',
name: 'releaseDate',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,25 @@ import 'src/app/component/filter/sw-base-filter';
import 'src/app/component/form/sw-select-field';
import 'src/app/component/form/field-base/sw-block-field';
import 'src/app/component/form/field-base/sw-base-field';
import { createLocalVue, shallowMount } from '@vue/test-utils_v2';
import { mount } from '@vue/test-utils';

const { Criteria } = Shopware.Data;

async function createWrapper() {
const localVue = createLocalVue();

return shallowMount(await Shopware.Component.build('sw-existence-filter'), {
localVue,
stubs: {
'sw-block-field': await Shopware.Component.build('sw-block-field'),
'sw-base-field': await Shopware.Component.build('sw-base-field'),
'sw-select-field': await Shopware.Component.build('sw-select-field'),
'sw-base-filter': await Shopware.Component.build('sw-base-filter'),
'sw-icon': true,
'sw-field-error': {
template: '<div></div>',
return mount(await wrapTestComponent('sw-existence-filter', { sync: true }), {
global: {
stubs: {
'sw-block-field': await wrapTestComponent('sw-block-field', { sync: true }),
'sw-base-field': await wrapTestComponent('sw-base-field', { sync: true }),
'sw-select-field': await wrapTestComponent('sw-select-field', { sync: true }),
'sw-base-filter': await wrapTestComponent('sw-base-filter', { sync: true }),
'sw-icon': true,
'sw-field-error': {
template: '<div></div>',
},
},
},
propsData: {
props: {
filter: {
property: 'media',
name: 'media',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'src/app/component/form/sw-select-field';
import 'src/app/component/form/field-base/sw-block-field';
import 'src/app/component/form/field-base/sw-base-field';
import 'src/app/component/filter/sw-base-filter';
import { shallowMount } from '@vue/test-utils_v2';
import { mount } from '@vue/test-utils';

const filters = [
{
Expand Down Expand Up @@ -65,40 +65,42 @@ const filters = [
let savedFilterData = {};

async function createWrapper() {
return shallowMount(await Shopware.Component.build('sw-filter-panel'), {
propsData: {
return mount(await wrapTestComponent('sw-filter-panel', { sync: true }), {
props: {
title: 'Filter',
entity: 'product',
filters,
storeKey: 'config',
defaults: ['filter1', 'filter2', 'filter3', 'filter4', 'filter5', 'filter6', 'filter7'],
},
stubs: {
'sw-boolean-filter': await Shopware.Component.build('sw-boolean-filter'),
'sw-select-field': await Shopware.Component.build('sw-select-field'),
'sw-block-field': await Shopware.Component.build('sw-block-field'),
'sw-base-field': await Shopware.Component.build('sw-base-field'),
'sw-base-filter': await Shopware.Component.build('sw-base-filter'),
'sw-field-error': {
template: '<div></div>',
global: {
stubs: {
'sw-boolean-filter': await Shopware.Component.build('sw-boolean-filter'),
'sw-select-field': await Shopware.Component.build('sw-select-field'),
'sw-block-field': await Shopware.Component.build('sw-block-field'),
'sw-base-field': await Shopware.Component.build('sw-base-field'),
'sw-base-filter': await Shopware.Component.build('sw-base-filter'),
'sw-field-error': {
template: '<div></div>',
},
'sw-icon': true,
'sw-existence-filter': await Shopware.Component.build('sw-existence-filter'),
'sw-multi-select-filter': true,
'sw-string-filter': true,
'sw-number-filter': true,
'sw-date-filter': true,
},
'sw-icon': true,
'sw-existence-filter': await Shopware.Component.build('sw-existence-filter'),
'sw-multi-select-filter': true,
'sw-string-filter': true,
'sw-number-filter': true,
'sw-date-filter': true,
},
provide: {
repositoryFactory: {
create: () => ({
create: () => Promise.resolve({
key: 'config',
userId: '1',
provide: {
repositoryFactory: {
create: () => ({
create: () => Promise.resolve({
key: 'config',
userId: '1',
}),
search: () => Promise.resolve(savedFilterData),
save: () => Promise.resolve([]),
}),
search: () => Promise.resolve(savedFilterData),
save: () => Promise.resolve([]),
}),
},
},
},
});
Expand Down
Loading

0 comments on commit 95e5eee

Please sign in to comment.