ribcage-gen
Advanced tools
Comparing version 0.2.0 to 0.2.1
var test = require('prova') | ||
, {{PascalName}} = require('./index.js') | ||
, sinon = require('sinon') | ||
, createView = function createView(options){ | ||
@@ -7,5 +8,5 @@ return new {{PascalName}}(options) | ||
test('{{PascalName}} Component: constructor', function(t){ | ||
test('{{PascalName}}: constructor', function(t){ | ||
var view = createView() | ||
var view = createView() | ||
t.equal( | ||
@@ -20,6 +21,56 @@ typeof view | ||
test('{{PascalName}} Component: beforeInit', function(t){ | ||
test('{{PascalName}}#bindEvents', function (t){ | ||
var view = createView() | ||
, fn = view.bindEvents | ||
, stopListening | ||
function setup(){ | ||
stopListening = sinon.spy(view, 'stopListening') | ||
} | ||
function cleanup(){ | ||
stopListening.restore() | ||
} | ||
setup() | ||
// call bind events | ||
fn.call(view) | ||
t.ok( | ||
stopListening.calledOnce | ||
, 'calls stopListening so that events aren\'t bound multiple times' | ||
) | ||
t.ok( | ||
stopListening.calledWith(view.state) | ||
, 'calls stopListening with the state so that not all listeners are removed' | ||
) | ||
cleanup() | ||
t.end() | ||
}) | ||
test('{{PascalName}}#beforeInit', function(t){ | ||
var view = createView() | ||
, fn = view.beforeInit | ||
fn.call(view) | ||
t.ok( | ||
view.state instanceof view.State | ||
, 'creates a state model' | ||
) | ||
t.end() | ||
}) | ||
test('{{PascalName}}#context', function(t){ | ||
var view = createView() | ||
, fn = view.context | ||
t.deepEqual( | ||
fn.call(view) | ||
, view.state.toJSON() | ||
, 'uses the state to pass variables to the template' | ||
) | ||
t.end() | ||
}) |
{ | ||
"name": "ribcage-gen", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "A generator script for ribcage components", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
6935
148
0