-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
127 additions
and
10 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
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,16 @@ | ||
const webpack = require( 'webpack' ); | ||
const _ = require('underscore'); | ||
const Plugin = require('./plugin'); | ||
|
||
module.exports = function(options){ | ||
if(!options) options = {}; | ||
|
||
if(!_.isObject(options)) | ||
throw new Error('invalid-prop', 'Passed param should be an object'); | ||
|
||
var config = {}; | ||
|
||
Object.assign(config, options); | ||
|
||
return new Plugin('Provider', webpack.ProvidePlugin, config); | ||
} |
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
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,49 @@ | ||
const assert = require( 'chai' ).assert; | ||
const provide = require( '../../plugins/provide' ); | ||
|
||
var plugin; | ||
describe( 'provide', function() { | ||
beforeEach(function(){ | ||
plugin = provide() | ||
}); | ||
|
||
describe( 'return', function ( ) { | ||
|
||
describe( 'when no param is passed', function ( ) { | ||
|
||
it( 'should return an object', function () { | ||
assert.isObject( provide() ); | ||
} ); | ||
|
||
} ); | ||
|
||
describe( 'when passed param is an object', function ( ) { | ||
|
||
it( 'should return an object', function () { | ||
assert.isObject( provide({}) ); | ||
} ); | ||
|
||
} ); | ||
|
||
describe( 'when passed param is not an object', function ( ) { | ||
|
||
it( 'should return an object', function () { | ||
assert.throws( () => provide(1), Error ); | ||
} ); | ||
|
||
} ); | ||
|
||
describe( 'properties', function ( ) { | ||
|
||
it( 'should define a name property', function () { | ||
assert.isString( plugin.name ); | ||
} ); | ||
|
||
it( 'should define a plugin property', function () { | ||
assert.isObject( plugin.plugin ); | ||
} ); | ||
|
||
} ); | ||
|
||
} ); | ||
} ); |
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