prop and withAttr tests
This commit is contained in:
parent
477e73f300
commit
a2c01d1d96
4 changed files with 61 additions and 1 deletions
25
util/tests/test-withAttr.js
Normal file
25
util/tests/test-withAttr.js
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
"use strict"
|
||||
|
||||
var o = require("../../ospec/ospec")
|
||||
var withAttr = require("../../util/withAttr")
|
||||
|
||||
o.spec("withAttr", function() {
|
||||
o("works", function() {
|
||||
var spy = o.spy()
|
||||
var context = {
|
||||
handler: withAttr("value", spy)
|
||||
}
|
||||
context.handler({currentTarget: {value: 1}})
|
||||
|
||||
o(spy.args).deepEquals([1])
|
||||
o(spy.this).equals(context)
|
||||
})
|
||||
o("context arg works", function() {
|
||||
var spy = o.spy()
|
||||
var context = {}
|
||||
var handler = withAttr("value", spy, context)
|
||||
handler({currentTarget: {value: 1}})
|
||||
|
||||
o(spy.this).equals(context)
|
||||
})
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue