This repository has been archived by the owner on Apr 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
requirejs, node tests, mocha, readme improved
- Loading branch information
Showing
12 changed files
with
248 additions
and
150 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
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 |
---|---|---|
|
@@ -4,4 +4,7 @@ node_js: | |
before_script: | ||
- npm i | ||
|
||
script: npm test | ||
script: | ||
- npm run lint | ||
- npm run test | ||
- npm run build |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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,40 @@ | ||
var pluginNameFactory = 'testfactory'; | ||
var pluginNameInstance = 'testinstance'; | ||
var pluginOptString = 'options'; | ||
var pluginOptObject = { | ||
string: 'This is a test', | ||
array : [ 1,2,'a'] | ||
}; | ||
var pluginOptArray = [1,2,'b']; | ||
var pluginFunc = function($el, opt, old) { | ||
this.$el = $el; | ||
this.opt = opt; | ||
this.old = old; | ||
|
||
this.destroy = function() { | ||
this.$el.removeData(pluginNameInstance); | ||
}; | ||
|
||
this.update = function(opt, opt2, opt3) { | ||
this.opt = opt; | ||
this.opt2 = opt2; | ||
this.opt3 = opt3; | ||
} | ||
}; | ||
|
||
var testEl = '#test'; | ||
var testWDataEl = '#test-w-data'; | ||
var testData = 'some useful data'; // the same as in HTML | ||
|
||
if ( typeof module == 'object') | ||
module.exports = { | ||
pluginNameFactory: pluginNameFactory, | ||
pluginNameInstance: pluginNameInstance, | ||
pluginOptString: pluginOptString, | ||
pluginOptObject: pluginOptObject, | ||
pluginOptArray: pluginOptArray, | ||
pluginFunc: pluginFunc, | ||
testEl: testEl, | ||
testWDataEl: testWDataEl, | ||
testData: testData | ||
}; |
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,16 @@ | ||
var window = require('jsdom').jsdom('<div />').defaultView, | ||
$ = require('jquery')(window), | ||
factory = require('..')($); | ||
|
||
var assert = require('chai').assert; | ||
|
||
var data = require('./tests-data.js'); | ||
|
||
describe('require test', function () { | ||
|
||
it('shoud has factory and create plugin', function() { | ||
assert.equal('function', typeof factory(data.pluginNameFactory, data.pluginFunc)); | ||
assert.equal('function', typeof $.fn[data.pluginNameFactory]); | ||
}); | ||
|
||
}); |
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
Oops, something went wrong.