Skip to content

Commit

Permalink
Basic testing framework (shipshapecode#199)
Browse files Browse the repository at this point in the history
* add mocha package and basic setup

* add more to the tour tests

* add travis gulp build for tests

* Update .gitignore

* Update .gitignore

* Update .gitignore
  • Loading branch information
chuckcarpenter authored and RobbieTheWagner committed Aug 1, 2018
1 parent b212313 commit f7d5fc0
Show file tree
Hide file tree
Showing 6 changed files with 827 additions and 41 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/.idea/
/dist/
/.log/
/node_modules/

/.DS_Store
/.sass-cache
/npm-debug.log*
/yarn-error.log
/yarn-error.log
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:
- stage: test
script:
- yarn lint
- gulp js
- npm test
- stage: npm release
script:
- yarn build
Expand Down
5 changes: 2 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ const umdOptions = {
name: 'Popper',
globalName: 'Popper',
paramName: 'Popper',
amdName: 'popper',
cjsName: 'popper'
amdName: 'popper.js',
cjsName: 'popper.js'
}]
};


// Clean
gulp.task('clean', function() {
del.sync([distDir]);
Expand Down
13 changes: 9 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@
"maintainers": [
"Nicholas Hwang <nick.joosung.hwang@gmail.com>",
"Geoff Daigle <geoffreydaigle@gmail.com>",
"Robert Wagner <rwwagner90@gmail.com>"
"Robert Wagner <rwwagner90@gmail.com>",
"Chuck Carpenter <charleswcarpenter3@gmail.com>"
],
"scripts": {
"build": "gulp build",
"docs": "gulp docs",
"lint:js": "eslint ./src/js/shepherd.js",
"lint:styles": "stylelint ./src/css/**/*.scss ./docs/welcome/sass/welcome.scss",
"lint": "yarn lint:js && yarn lint:styles"
"lint": "yarn lint:js && yarn lint:styles",
"test": "mocha"
},
"homepage": "http://shipshapecode.github.io/shepherd/docs/welcome/",
"license": "MIT",
Expand All @@ -29,7 +31,8 @@
"main": "shepherd.js"
},
"dependencies": {
"popper.js": "^1.14.3"
"popper.js": "^1.14.3",
"yarn": "^1.9.2"
},
"devDependencies": {
"@babel/core": "^7.0.0-beta.52",
Expand All @@ -48,8 +51,10 @@
"gulp-sequence": "^1.0.0",
"gulp-uglify-es": "^1.0.4",
"gulp-wrap-umd": "^0.2.1",
"mocha": "^5.2.0",
"stylelint": "^9.3.0",
"stylelint-config-ship-shape": "^0.4.0"
"stylelint-config-ship-shape": "^0.4.0",
"testem": "^2.8.2"
},
"engines": {
"node": ">= 6.*"
Expand Down
38 changes: 38 additions & 0 deletions test/test.tour.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/* global require,describe,it */
const assert = require('assert');
const Shepherd = require('../dist/js/shepherd.js');

describe('Shepherd', function() {
describe('.Tour()', function() {
const instance = new Shepherd.Tour({
defaults: {
classes: 'shepherd-theme-arrows',
scrollTo: true
}
});
it('creates a new tour instance', function() {

assert.ok(instance instanceof Shepherd.Tour);
});

it('returns the default options on the instance', function() {
assert.ok(instance.options);
});

describe('.addStep()', function() {
it('adds tour steps', function() {
instance.addStep('test', {
text: 'This is a test step for our tour'
});

assert.equal(instance.steps.length, 1);
});

// this is not working as documented
it.skip('returns the step options', function() {
assert.ok(instance.defaults);
});
});

});
});
Loading

0 comments on commit f7d5fc0

Please sign in to comment.