Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic testing framework #199

Merged
merged 6 commits into from
Aug 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 <[email protected]>",
"Geoff Daigle <[email protected]>",
"Robert Wagner <[email protected]>"
"Robert Wagner <[email protected]>",
"Chuck Carpenter <[email protected]>"
],
"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