-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#100 - Add base test for AddressFields components
- Loading branch information
Showing
2 changed files
with
144 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { shallowMount, createLocalVue } from '@vue/test-utils' | ||
import AddressFields from '../view/frontend/web/js/components/AddressFields.vue' | ||
import VeeValidate from 'vee-validate' | ||
|
||
const localVue = createLocalVue() | ||
localVue.use(VeeValidate) | ||
|
||
describe('AddressFields.test.js', () => { | ||
let wrapper | ||
|
||
beforeEach(() => { | ||
wrapper = shallowMount(AddressFields, { | ||
propsData: { | ||
type: 'shippingAddress' | ||
}, | ||
computed: { | ||
addressData: () => { | ||
return { | ||
city: 'Arizona', | ||
company: 'Cafe', | ||
country_id: { | ||
is_region_visible: true, | ||
label: 'United States', | ||
value: 'US', | ||
}, | ||
firstname: 'John', | ||
lastname: 'Lennon', | ||
postcode: '12312', | ||
region: 'Arizona', | ||
region_id: { | ||
country_id: 'US', | ||
label: 'Arizona', | ||
title: 'Arizona', | ||
value: '4' | ||
}, | ||
street0: 'Sample Street', | ||
street1: '2', | ||
telephone: '123123123', | ||
} | ||
}, | ||
regions: () => { | ||
return [ | ||
{ | ||
country_id: 'US', | ||
label: 'Arizona', | ||
title: 'Arizona', | ||
value: '4' | ||
} | ||
] | ||
} | ||
}, | ||
localVue | ||
}) | ||
}) | ||
|
||
it('has the expected html structure', () => { | ||
expect(wrapper.element).toMatchSnapshot() | ||
}) | ||
}) |
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,85 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`AddressFields.test.js has the expected html structure 1`] = ` | ||
<div> | ||
<baseinput-stub /> | ||
<baseinput-stub /> | ||
<baseinput-stub /> | ||
<baseinput-stub /> | ||
<baseinput-stub /> | ||
<div | ||
class="" | ||
> | ||
<label | ||
for="country" | ||
> | ||
Select Country | ||
</label> | ||
<vue-multiselect-stub | ||
aria-invalid="false" | ||
aria-required="true" | ||
data-vv-as="Country" | ||
id="country" | ||
label="label" | ||
options="[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]" | ||
placeholder="Select country" | ||
/> | ||
<span | ||
class="input__message" | ||
style="display: none;" | ||
> | ||
</span> | ||
</div> | ||
<baseinput-stub /> | ||
<baseinput-stub /> | ||
<!----> | ||
<div | ||
class="" | ||
> | ||
<label | ||
for="region_id" | ||
> | ||
Select State/Province | ||
</label> | ||
<vue-multiselect-stub | ||
aria-invalid="false" | ||
aria-required="true" | ||
data-vv-as="Region" | ||
id="region_id" | ||
label="label" | ||
options="[object Object]" | ||
placeholder="Select State/Province" | ||
/> | ||
<span | ||
class="input__message" | ||
style="display: none;" | ||
> | ||
</span> | ||
</div> | ||
<baseinput-stub /> | ||
</div> | ||
`; |