-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
63 lines (50 loc) · 1.63 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*eslint no-unused-expressions: 0*/
/**
* Module dependencies
*/
var anchorFactory = require('./index');
var should = require('should');
var react = require('react');
var dom = react.DOM;
/**
* Test
*/
describe('factory = anchorFactory()', function() {
it('should return a function', function() {
anchorFactory({}).should.be.of.type('function');
});
});
describe('factory()', function () {
var factory = anchorFactory({
onClick: function() {done()},
className: 'hello'
});
it('should have default settings', function() {
var props = factory({})._store.props;
props.className.should.eql('hello');
props.onClick.should.be.of.type('function');
});
it('should use a string as the first arg', function() {
var props = factory({href: '/hello'})._store.props;
props.href.should.eql('/hello');
});
it('should accept an object as the first arg', function() {
var props = factory({href: '/hi', className: ''})._store.props;
props.href.should.eql('/hi');
props.className.should.eql('hello');
});
it('should set the inner body', function() {
var props = factory({children: 'world'})._store.props;
props.children.should.eql('world');
});
it('should extend default settings', function() {
var props = factory({className: 'howdy'})._store.props;
props.className.should.eql('hello howdy');
});
it('should not cause conflicts on multiple yields', function() {
var props = factory({className: 'howdy'})._store.props;
props.className.should.eql('hello howdy');
var props = factory({className: 'howdy'})._store.props;
props.className.should.eql('hello howdy');
});
});