-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #268 from cosmos/matt/233-common-tests
Matt's share of the tests
- Loading branch information
Showing
14 changed files
with
185 additions
and
48 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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
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
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
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
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
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,50 @@ | ||
import { mount } from 'vue-test-utils' | ||
import NiPart from 'common/NiPart' | ||
|
||
describe('NiPart', () => { | ||
let wrapper | ||
|
||
beforeEach(() => { | ||
wrapper = mount(NiPart, { | ||
propsData: { | ||
title: 'Test' | ||
} | ||
}) | ||
}) | ||
|
||
it('has the expected html structure', () => { | ||
expect(wrapper.vm.$el).toMatchSnapshot() | ||
}) | ||
|
||
it('only has header if a title is defined', () => { | ||
wrapper = mount(NiPart, { | ||
slots: { | ||
default: '<custom-main />' | ||
} | ||
}) | ||
expect(wrapper.find('header').exists()).toBe(false) | ||
expect(wrapper.find('custom-main').exists()).toBe(true) | ||
}) | ||
|
||
it('gets title from prop if defined', () => { | ||
wrapper = mount(NiPart, { | ||
propsData: { | ||
title: 'Test' | ||
} | ||
}) | ||
expect(wrapper.find('.ni-part-title').text()).toBe('Test') | ||
}) | ||
|
||
it('should use slots', () => { | ||
wrapper = mount(NiPart, { | ||
slots: { | ||
title: '<custom-title />', | ||
default: '<custom-main />', | ||
menu: '<custom-menu />' | ||
} | ||
}) | ||
expect(wrapper.find('custom-title').exists()).toBe(true) | ||
expect(wrapper.find('custom-menu').exists()).toBe(true) | ||
expect(wrapper.find('custom-main').exists()).toBe(true) | ||
}) | ||
}) |
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
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,18 @@ | ||
import { mount } from 'vue-test-utils' | ||
import NiTabBar from 'common/NiTabBar' | ||
|
||
describe('NiTabBar', () => { | ||
let wrapper | ||
|
||
beforeEach(() => { | ||
wrapper = mount(NiTabBar, { | ||
slots: { | ||
default: '<main-slot />' | ||
} | ||
}) | ||
}) | ||
|
||
it('has the expected html structure', () => { | ||
expect(wrapper.vm.$el).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,40 @@ | ||
import { mount } from 'vue-test-utils' | ||
import NiTag from 'common/NiTag' | ||
|
||
describe('NiTag', () => { | ||
let wrapper | ||
|
||
it('has the expected html structure', () => { | ||
wrapper = mount(NiTag, {}) | ||
expect(wrapper.vm.$el).toMatchSnapshot() | ||
}) | ||
|
||
it('has the expected value', () => { | ||
wrapper = mount(NiTag, { | ||
propsData: { value: 'Value' } | ||
}) | ||
expect(wrapper.vm.$el.textContent).toBe('Value') | ||
}) | ||
|
||
it('has the expected classes for default size', () => { | ||
wrapper = mount(NiTag, {}) | ||
expect(wrapper.find('.ni-tag').exists()).toBe(true) | ||
expect(wrapper.find('.ni-tag-df').exists()).toBe(true) | ||
}) | ||
|
||
it('has the expected classes for small size', () => { | ||
wrapper = mount(NiTag, { | ||
propsData: { size: 'sm' } | ||
}) | ||
expect(wrapper.find('.ni-tag').exists()).toBe(true) | ||
expect(wrapper.find('.ni-tag-sm').exists()).toBe(true) | ||
}) | ||
|
||
it('has the expected classes for large size', () => { | ||
wrapper = mount(NiTag, { | ||
propsData: { size: 'lg' } | ||
}) | ||
expect(wrapper.find('.ni-tag').exists()).toBe(true) | ||
expect(wrapper.find('.ni-tag-lg').exists()).toBe(true) | ||
}) | ||
}) |
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,31 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`NiPart has the expected html structure 1`] = ` | ||
<section | ||
class="ni-part" | ||
> | ||
<div | ||
class="ni-part-container" | ||
> | ||
<header | ||
class="ni-part-header" | ||
> | ||
<div | ||
class="ni-part-header-container" | ||
> | ||
<div | ||
class="ni-part-title h5" | ||
> | ||
Test | ||
</div> | ||
<menu | ||
class="ni-part-menu" | ||
/> | ||
</div> | ||
</header> | ||
<main | ||
class="ni-part-main" | ||
/> | ||
</div> | ||
</section> | ||
`; |
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,13 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`NiTabBar has the expected html structure 1`] = ` | ||
<div | ||
class="ni-tab-bar" | ||
> | ||
<div | ||
class="ni-tab-bar-container" | ||
> | ||
<main-slot /> | ||
</div> | ||
</div> | ||
`; |
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,9 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`NiTag has the expected html structure 1`] = ` | ||
<div | ||
class="ni-tag ni-tag ni-tag-df" | ||
> | ||
</div> | ||
`; |