Skip to content

Commit

Permalink
chore: update storybook stories
Browse files Browse the repository at this point in the history
  • Loading branch information
julon committed Feb 9, 2018
1 parent 8b58049 commit b4ce71c
Show file tree
Hide file tree
Showing 7 changed files with 270 additions and 53 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ typings/

# Generated code
dist/
docs/

### VisualStudioCode ###
.vscode/*
Expand Down
2 changes: 2 additions & 0 deletions .storybook/addons.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import '@storybook/addon-knobs/register';
import '@storybook/addon-options/register';
14 changes: 13 additions & 1 deletion .storybook/config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
import { configure } from '@storybook/vue';
import { setOptions } from '@storybook/addon-options';
import Vue from 'vue';

// Import your custom components.
import ModuleLibrary from '@/index';


// Example theme
import './styles.css';

// Option defaults:
setOptions({
name: 'Pianow',
url: '#',
goFullScreen: false,
showStoriesPanel: true,
showAddonPanel: true,
showSearchBox: false,
addonPanelInRight: true,
});

// Install this library
Vue.use(ModuleLibrary);

Expand Down
108 changes: 108 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"build:umd:dev": "rollup -c --environment TARGET:umd-dev",
"build:umd:prod": "rollup -c --environment TARGET:umd-prod",
"storybook": "start-storybook -p 9001 -c .storybook",
"storybook:build": "build-storybook -c .storybook -o docs/dist/stories",
"storybook:build": "build-storybook -c .storybook -o docs",
"precommit": "lint-staged",
"cz": "git-cz",
"commitmsg": "commitlint -e $GIT_PARAMS",
Expand All @@ -54,6 +54,8 @@
"@semantic-release/git": "^2.0.1",
"@semantic-release/github": "^3.0.1",
"@semantic-release/npm": "^2.6.1",
"@storybook/addon-knobs": "^3.3.12",
"@storybook/addon-options": "^3.3.12",
"@storybook/vue": "^3.3.3",
"babel-core": "^6.26.0",
"babel-eslint": "^8.1.2",
Expand Down Expand Up @@ -112,14 +114,12 @@
"release": {
"verifyConditions": [
"@semantic-release/changelog",
"@semantic-release/npm",
"@semantic-release/git",
"@semantic-release/github"
],
"getLastRelease": "@semantic-release/npm",
"getLastRelease": "@semantic-release/github",
"publish": [
"@semantic-release/changelog",
"@semantic-release/npm",
"@semantic-release/git",
"@semantic-release/github"
]
Expand Down
27 changes: 18 additions & 9 deletions src/__tests__/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
import ModuleLibrary from "../index";

test("Should register all components when installed", () => {
const component = jest.fn();
const Vue = { component };
describe("Index.js", () => {
it("should register all components when installed", () => {
const component = jest.fn();
const Vue = { component };

ModuleLibrary.install(Vue);
ModuleLibrary.install(Vue);

// Test if a particular component was registered
expect(component).toBeCalledWith("hello-world", expect.any(Object));
// Test if a particular component was registered
expect(component).toBeCalledWith("instant-search", expect.any(Object));
expect(component).toBeCalledWith("search-index", expect.any(Object));
expect(component).toBeCalledWith("search-results", expect.any(Object));
expect(component).toBeCalledWith("search-box", expect.any(Object));
expect(component).toBeCalledWith(
"search-box-autocomplete",
expect.any(Object)
);

// Test how many times component got registered
const totalOfComponents = 1;
expect(component).toHaveBeenCalledTimes(totalOfComponents);
// Test how many times component got registered
const totalOfComponents = 5;
expect(component).toHaveBeenCalledTimes(totalOfComponents);
});
});
Loading

0 comments on commit b4ce71c

Please sign in to comment.