Skip to content

Commit

Permalink
v0.6.0 - Updated & fixed npm scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
Damian Mullins committed Dec 20, 2017
1 parent b3da842 commit 67df04e
Show file tree
Hide file tree
Showing 7 changed files with 1,934 additions and 1,140 deletions.
8 changes: 1 addition & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,5 @@ node_js:

cache: yarn

before_script:
- yarn run lint

script:
- yarn test:cover

after_success:
- yarn run test:cover:CI
- yarn run test:coveralls
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).


v0.6.0
------------------------------
*December 20, 2017*

### Added
- Added lint paths to build config.
- Using `concurrently` to run npm scripts concurrently...!

### Changed
- Updated package versions.
- Updated unit test helper function names.
- Updated Travis config.
- Tidied up npm scripts config.
- Fixed ESlint issues.



v0.5.0
------------------------------
*September 21, 2017*
Expand Down
6 changes: 5 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
const gulp = require('gulp');
const { build } = require('@justeat/gulp-build-fozzie');

build(gulp);
build(gulp, {
js: {
lintPaths: ['{src,test}/**/*.js']
}
});
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@justeat/f-toggle",
"description": "Fozzie vanilla JS toggle library.",
"version": "0.5.0",
"version": "0.6.0",
"main": "dist/index.js",
"homepage": "https://github.com/justeat/f-toggle",
"contributors": [
Expand All @@ -23,24 +23,24 @@
"qwery": "^4.0.0"
},
"devDependencies": {
"@justeat/gulp-build-fozzie": "^6.0.0",
"@justeat/gulp-build-fozzie": "^6.5.0",
"babel-cli": "^6.26.0",
"babel-preset-babili": "^0.1.4",
"babel-preset-es2015": "^6.24.1",
"coveralls": "^2.13.1",
"concurrently": "^3.5.1",
"coveralls": "^3.0.0",
"gulp": "^3.9.1",
"js-test-buddy": "^0.0.3"
"js-test-buddy": "^0.0.7"
},
"keywords": [
"fozzie"
],
"scripts": {
"prepare": "yarn run lint && yarn test && yarn run compile",
"prepare": "concurrently -n \"lint,compile,test\" -c \"blue,yellow,green\" --kill-others-on-fail \"yarn lint\" \"yarn compile\" \"yarn run test\"",
"lint": "gulp scripts:lint",
"compile": "babel -d dist src",
"test": "gulp scripts:test",
"test:cover": "gulp scripts:test:coverage",
"test:cover:CI": "cat coverage/lcov.info | coveralls",
"lint": "gulp scripts:lint"
"test": "gulp scripts:test:coverage",
"test:coveralls": "cat coverage/lcov.info | coveralls"
},
"jest": {
"collectCoverageFrom": [
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const setupToggle = () => {
});
});

}
};

ready(() => {

Expand Down
70 changes: 35 additions & 35 deletions test/index.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import toggle from '../src/index';
import TestUtils from 'js-test-buddy';
import toggle from '../src/index';


describe('module', () => {
Expand All @@ -14,7 +14,7 @@ describe('toggle', () => {

it('adds hidden class', () => {
// Arrange
TestUtils.setHtml(`
TestUtils.setBodyHtml(`
<div data-toggle-name="test"></div>
<button data-toggle-target="test"></button>
`);
Expand All @@ -25,13 +25,13 @@ describe('toggle', () => {
TestUtils.click(button);

// Assert
const html = TestUtils.getHtml();
const html = TestUtils.getBodyHtml();
expect(html).toMatchSnapshot();
});

it('removes hidden class', () => {
// Arrange
TestUtils.setHtml(`
TestUtils.setBodyHtml(`
<div data-toggle-name="test" class="is-hidden"></div>
<button data-toggle-target="test"></button>
`);
Expand All @@ -42,12 +42,12 @@ describe('toggle', () => {
TestUtils.click(button);

// Assert
expect(TestUtils.getHtml()).toMatchSnapshot();
expect(TestUtils.getBodyHtml()).toMatchSnapshot();
});

it('adds custom class when specified', () => {
// Arrange
TestUtils.setHtml(`
TestUtils.setBodyHtml(`
<div data-toggle-name="test"></div>
<button data-toggle-target="test" data-toggle-class="toggled"></button>
`);
Expand All @@ -58,12 +58,12 @@ describe('toggle', () => {
TestUtils.click(button);

// Assert
expect(TestUtils.getHtml()).toMatchSnapshot();
expect(TestUtils.getBodyHtml()).toMatchSnapshot();
});

it('removes custom class when specified', () => {
// Arrange
TestUtils.setHtml(`
TestUtils.setBodyHtml(`
<div data-toggle-name="test" class="toggled"></div>
<button data-toggle-target="test" data-toggle-class="toggled"></button>
`);
Expand All @@ -74,12 +74,12 @@ describe('toggle', () => {
TestUtils.click(button);

// Assert
expect(TestUtils.getHtml()).toMatchSnapshot();
expect(TestUtils.getBodyHtml()).toMatchSnapshot();
});

it('can handle multiple targets', () => {
// Arrange
TestUtils.setHtml(`
TestUtils.setBodyHtml(`
<div data-toggle-name="test"></div>
<div data-toggle-name="test" class="is-hidden"></div>
<button data-toggle-target="test"></button>
Expand All @@ -91,12 +91,12 @@ describe('toggle', () => {
TestUtils.click(button);

// Assert
expect(TestUtils.getHtml()).toMatchSnapshot();
expect(TestUtils.getBodyHtml()).toMatchSnapshot();
});

it('can handle multiple specified targets', () => {
// Arrange
TestUtils.setHtml(`
TestUtils.setBodyHtml(`
<div data-toggle-name="one" class="is-hidden"></div>
<div data-toggle-name="two"></div>
<button data-toggle-target="one two"></button>
Expand All @@ -108,7 +108,7 @@ describe('toggle', () => {
TestUtils.click(button);

// Assert
expect(TestUtils.getHtml()).toMatchSnapshot();
expect(TestUtils.getBodyHtml()).toMatchSnapshot();
});

});
Expand All @@ -117,7 +117,7 @@ describe('show', () => {

it('does nothing when element is already shown', () => {
// Arrange
TestUtils.setHtml(`
TestUtils.setBodyHtml(`
<div data-toggle-name="test"></div>
<button data-toggle-target="show:test"></button>
`);
Expand All @@ -128,12 +128,12 @@ describe('show', () => {
TestUtils.click(button);

// Assert
expect(TestUtils.getHtml()).toMatchSnapshot();
expect(TestUtils.getBodyHtml()).toMatchSnapshot();
});

it('removes hidden class', () => {
// Arrange
TestUtils.setHtml(`
TestUtils.setBodyHtml(`
<div data-toggle-name="test" class="is-hidden"></div>
<button data-toggle-target="show:test"></button>
`);
Expand All @@ -144,12 +144,12 @@ describe('show', () => {
TestUtils.click(button);

// Assert
expect(TestUtils.getHtml()).toMatchSnapshot();
expect(TestUtils.getBodyHtml()).toMatchSnapshot();
});

it('removes custom class', () => {
// Arrange
TestUtils.setHtml(`
TestUtils.setBodyHtml(`
<div data-toggle-name="test" class="toggled"></div>
<button data-toggle-target="show:test" data-toggle-class="toggled"></button>
`);
Expand All @@ -160,12 +160,12 @@ describe('show', () => {
TestUtils.click(button);

// Assert
expect(TestUtils.getHtml()).toMatchSnapshot();
expect(TestUtils.getBodyHtml()).toMatchSnapshot();
});

it('can handle multiple targets', () => {
// Arrange
TestUtils.setHtml(`
TestUtils.setBodyHtml(`
<div data-toggle-name="test"></div>
<div data-toggle-name="test" class="is-hidden"></div>
<button data-toggle-target="show:test"></button>
Expand All @@ -177,12 +177,12 @@ describe('show', () => {
TestUtils.click(button);

// Assert
expect(TestUtils.getHtml()).toMatchSnapshot();
expect(TestUtils.getBodyHtml()).toMatchSnapshot();
});

it('can handle multiple specified targets', () => {
// Arrange
TestUtils.setHtml(`
TestUtils.setBodyHtml(`
<div data-toggle-name="one" class="is-hidden"></div>
<div data-toggle-name="two" class="is-hidden"></div>
<button data-toggle-target="show:one show:two"></button>
Expand All @@ -194,7 +194,7 @@ describe('show', () => {
TestUtils.click(button);

// Assert
expect(TestUtils.getHtml()).toMatchSnapshot();
expect(TestUtils.getBodyHtml()).toMatchSnapshot();
});

});
Expand All @@ -203,7 +203,7 @@ describe('hide', () => {

it('does nothing when element is already hidden', () => {
// Arrange
TestUtils.setHtml(`
TestUtils.setBodyHtml(`
<div data-toggle-name="test" class="is-hidden"></div>
<button data-toggle-target="hide:test"></button>
`);
Expand All @@ -214,12 +214,12 @@ describe('hide', () => {
TestUtils.click(button);

// Assert
expect(TestUtils.getHtml()).toMatchSnapshot();
expect(TestUtils.getBodyHtml()).toMatchSnapshot();
});

it('adds hidden class', () => {
// Arrange
TestUtils.setHtml(`
TestUtils.setBodyHtml(`
<div data-toggle-name="test"></div>
<button data-toggle-target="hide:test"></button>
`);
Expand All @@ -230,12 +230,12 @@ describe('hide', () => {
TestUtils.click(button);

// Assert
expect(TestUtils.getHtml()).toMatchSnapshot();
expect(TestUtils.getBodyHtml()).toMatchSnapshot();
});

it('adds custom class', () => {
// Arrange
TestUtils.setHtml(`
TestUtils.setBodyHtml(`
<div data-toggle-name="test"></div>
<button data-toggle-target="hide:test" data-toggle-class="toggled"></button>
`);
Expand All @@ -246,12 +246,12 @@ describe('hide', () => {
TestUtils.click(button);

// Assert
expect(TestUtils.getHtml()).toMatchSnapshot();
expect(TestUtils.getBodyHtml()).toMatchSnapshot();
});

it('can handle multiple targets', () => {
// Arrange
TestUtils.setHtml(`
TestUtils.setBodyHtml(`
<div data-toggle-name="test"></div>
<div data-toggle-name="test" class="is-hidden"></div>
<button data-toggle-target="hide:test"></button>
Expand All @@ -263,12 +263,12 @@ describe('hide', () => {
TestUtils.click(button);

// Assert
expect(TestUtils.getHtml()).toMatchSnapshot();
expect(TestUtils.getBodyHtml()).toMatchSnapshot();
});

it('can handle multiple specified targets', () => {
// Arrange
TestUtils.setHtml(`
TestUtils.setBodyHtml(`
<div data-toggle-name="one"></div>
<div data-toggle-name="two"></div>
<button data-toggle-target="hide:one hide:two"></button>
Expand All @@ -280,7 +280,7 @@ describe('hide', () => {
TestUtils.click(button);

// Assert
expect(TestUtils.getHtml()).toMatchSnapshot();
expect(TestUtils.getBodyHtml()).toMatchSnapshot();
});

});
Expand All @@ -289,7 +289,7 @@ describe('mixed toggles', () => {

it('shows and hides elements correctly', () => {
// Arrange
TestUtils.setHtml(`
TestUtils.setBodyHtml(`
<div data-toggle-name="one"></div>
<div data-toggle-name="two" class="is-hidden"></div>
<div data-toggle-name="three" class="is-hidden"></div>
Expand All @@ -303,7 +303,7 @@ describe('mixed toggles', () => {
TestUtils.click(button);

// Assert
expect(TestUtils.getHtml()).toMatchSnapshot();
expect(TestUtils.getBodyHtml()).toMatchSnapshot();
});

});
Loading

0 comments on commit 67df04e

Please sign in to comment.