This repository has been archived by the owner on Apr 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
306 additions
and
15 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 |
---|---|---|
@@ -1,9 +1,12 @@ | ||
docs | ||
src | ||
lib | ||
test | ||
dist/index.docs.css | ||
dist/index.docs.js | ||
.babelrc | ||
.eslintrc.js | ||
.travis.yml | ||
webpack.config.js | ||
yarn.lock | ||
index.html |
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,6 @@ | ||
language: node_js | ||
node_js: | ||
- '9' | ||
script: | ||
- yarn run lint | ||
- yarn run test |
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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "office-ui-fabric-vue", | ||
"version": "0.1.0", | ||
"version": "1.0.0", | ||
"description": "Office UI Fabric implementation for Vue.js", | ||
"main": "dist/index.js", | ||
"author": "aidewoode <[email protected]>", | ||
|
@@ -22,7 +22,8 @@ | |
"server": "./node_modules/.bin/webpack-dev-server --inline --hot --env.development", | ||
"bundle": "./node_modules/.bin/webpack --env.production", | ||
"bundleLib": "./node_modules/.bin/webpack --env.production --env.lib", | ||
"test": "./node_modules/.bin/jest" | ||
"test": "./node_modules/.bin/jest", | ||
"lint": "./node_modules/.bin/eslint --ext .js,.vue src" | ||
}, | ||
"devDependencies": { | ||
"babel-core": "^6.24.1", | ||
|
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 |
---|---|---|
|
@@ -41,6 +41,7 @@ | |
}; | ||
} | ||
}, | ||
created() { | ||
this.eventHub.$on('addPivotItem', this.addPivotItem); | ||
}, | ||
|
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
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,46 @@ | ||
import { mount } from 'vue-test-utils'; | ||
|
||
import fabric from '../lib/office-ui-fabric'; | ||
import SearchBox from '../src/components/search_box/SearchBox.vue'; | ||
|
||
describe('SearchBox', () => { | ||
let wrapper; | ||
|
||
beforeEach(() => { | ||
wrapper = mount(SearchBox, { | ||
propsData: { | ||
placeholder: 'placeholder' | ||
}, | ||
|
||
mocks: { | ||
$fabric: fabric | ||
} | ||
}); | ||
}); | ||
|
||
afterEach(() => { | ||
wrapper.destroy(); | ||
}); | ||
|
||
test('should render correct', () => { | ||
expect(wrapper.contains('.ms-SearchBox')).toBeTruthy(); | ||
expect(wrapper.contains('.ms-SearchBox-field')).toBeTruthy(); | ||
expect(wrapper.find('.ms-SearchBox-text').text()).toBe('placeholder'); | ||
}); | ||
|
||
test('should return value when input text', () => { | ||
const inputEvent = jest.fn(); | ||
|
||
wrapper.vm.$on('input', inputEvent); | ||
wrapper.find('.ms-SearchBox-field').element.value = 'input'; | ||
wrapper.find('.ms-SearchBox-field').trigger('input'); | ||
|
||
expect(inputEvent).toBeCalledWith('input'); | ||
}); | ||
|
||
test('should can set input text by value', () => { | ||
wrapper.setProps({ value: 'input' }); | ||
|
||
expect(wrapper.find('.ms-SearchBox-field').element.value).toBe('input'); | ||
}); | ||
}); |
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,29 @@ | ||
import { mount } from 'vue-test-utils'; | ||
|
||
import fabric from '../lib/office-ui-fabric'; | ||
import Spinner from '../src/components/spinner/Spinner.vue'; | ||
|
||
describe('Spinner', () => { | ||
let wrapper; | ||
|
||
beforeEach(() => { | ||
wrapper = mount(Spinner, { | ||
propsData: { | ||
label: 'label' | ||
}, | ||
|
||
mocks: { | ||
$fabric: fabric | ||
} | ||
}); | ||
}); | ||
|
||
afterEach(() => { | ||
wrapper.destroy(); | ||
}); | ||
|
||
test('should render correct', () => { | ||
expect(wrapper.contains('.ms-Spinner')).toBeTruthy(); | ||
expect(wrapper.find('.ms-Spinner-label').text()).toBe('label'); | ||
}); | ||
}); |
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,57 @@ | ||
import { mount, createLocalVue } from 'vue-test-utils'; | ||
|
||
import Table from '../src/components/table/Table.vue'; | ||
import TableColumn from '../src/components/table/TableColumn.vue'; | ||
|
||
describe('Table', () => { | ||
const defaultSlot = [ | ||
"<table-column prop='name'>Name</table-column>", | ||
"<table-column prop='age'>Age</table-column>", | ||
]; | ||
|
||
const tableData = [ | ||
{ name: 'Ed', age: '24' }, | ||
{ name: 'Jack', age: '30' }, | ||
{ name: 'Blues', age: '51' }, | ||
]; | ||
|
||
let wrapper; | ||
|
||
beforeEach(() => { | ||
const localVue = createLocalVue(); | ||
|
||
localVue.component('table-column', TableColumn); | ||
|
||
wrapper = mount(Table, { | ||
propsData: { | ||
data: tableData | ||
}, | ||
|
||
slots: { | ||
default: defaultSlot, | ||
}, | ||
|
||
localVue | ||
}); | ||
}); | ||
|
||
afterEach(() => { | ||
wrapper.destroy(); | ||
}); | ||
|
||
test('should render correct', () => { | ||
const tableColumnProps = ['name', 'age'] | ||
|
||
expect(wrapper.contains('.ms-Table')).toBeTruthy(); | ||
expect(wrapper.findAll('th').length).toBe(defaultSlot.length); | ||
expect(wrapper.findAll('tbody tr').length).toBe(tableData.length); | ||
expect(wrapper.findAll('th').at(0).text()).toBe('Name'); | ||
expect(wrapper.findAll('th').at(1).text()).toBe('Age'); | ||
|
||
wrapper.element.querySelectorAll('tbody tr').forEach((trElement, trIndex) => { | ||
trElement.childNodes.forEach((tdElement, tdIndex) => { | ||
expect(tdElement.textContent.trim()).toBe(tableData[trIndex][tableColumnProps[tdIndex]]); | ||
}); | ||
}); | ||
}); | ||
}); |
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,53 @@ | ||
import { mount } from 'vue-test-utils'; | ||
|
||
import fabric from '../lib/office-ui-fabric'; | ||
import TextField from '../src/components/text_field/TextField.vue'; | ||
|
||
describe('TextField', () => { | ||
let wrapper; | ||
|
||
beforeEach(() => { | ||
wrapper = mount(TextField, { | ||
propsData: { | ||
label: 'label' | ||
}, | ||
|
||
mocks: { | ||
$fabric: fabric | ||
} | ||
}); | ||
}); | ||
|
||
afterEach(() => { | ||
wrapper.destroy(); | ||
}); | ||
|
||
test('should render correct', () => { | ||
expect(wrapper.contains('.ms-TextField')).toBeTruthy(); | ||
expect(wrapper.contains('input')).toBeTruthy(); | ||
expect(wrapper.find('.ms-Label').text()).toBe('label'); | ||
}); | ||
|
||
test('should be textarea when type is multiline ', () => { | ||
wrapper.setProps({ type: 'multiline' }); | ||
|
||
expect(wrapper.contains('input')).toBeFalsy(); | ||
expect(wrapper.contains('textarea')).toBeTruthy(); | ||
}); | ||
|
||
test('should return value when input text', () => { | ||
const inputEvent = jest.fn(); | ||
|
||
wrapper.vm.$on('input', inputEvent); | ||
wrapper.find('.ms-TextField-field').element.value = 'input'; | ||
wrapper.find('.ms-TextField-field').trigger('input'); | ||
|
||
expect(inputEvent).toBeCalledWith('input'); | ||
}); | ||
|
||
test('should can set input text by value', () => { | ||
wrapper.setProps({ value: 'input' }); | ||
|
||
expect(wrapper.find('.ms-TextField-field').element.value).toBe('input'); | ||
}); | ||
}); |
Oops, something went wrong.