-
Notifications
You must be signed in to change notification settings - Fork 12
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
mob8607
committed
Oct 13, 2013
1 parent
364e76b
commit 1de74a2
Showing
4 changed files
with
79 additions
and
4 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
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,74 @@ | ||
define(['husky'], function(husky) { | ||
|
||
'use strict'; | ||
|
||
var app, $button; | ||
|
||
ddescribe('Button', function() { | ||
$('body').append('<div id="button">'); | ||
app = husky({ debug: { enable: true }}); | ||
|
||
beforeEach(function() { | ||
runs(function() { | ||
app.start(document.body).then(function() { | ||
app.sandbox.start([ | ||
{ name: 'button@husky', options: { el: '#button', text: 'myText', instanceName: 'instance' } } | ||
]); | ||
}); | ||
}); | ||
|
||
waitsFor(function() { | ||
return $('.icon-btn').size() === 1; | ||
}, 'load icon', 500); | ||
|
||
runs(function() { | ||
$button = $('.icon-btn'); | ||
}); | ||
}); | ||
|
||
afterEach(function() { | ||
}); | ||
|
||
it('should be inserted into the dom', function() { | ||
expect($button.size()).toBe(1); | ||
}); | ||
|
||
it('has icon ok-circle', function() { | ||
var flag = false; | ||
runs(function() { | ||
app.sandbox.emit('husky.button.instance.set-content', 'test', 'circle-ok'); | ||
|
||
_.delay(function() { | ||
flag = true; | ||
}, 500); | ||
}); | ||
|
||
waitsFor(function() { | ||
return flag; | ||
}, 'load component', 500); | ||
|
||
runs(function() { | ||
expect($('.icon-btn').find('.loading-content').find('.icon-circle-ok').size()).toBe(1); | ||
}); | ||
}); | ||
|
||
it('can be disabled', function() { | ||
var flag = false; | ||
runs(function() { | ||
app.sandbox.emit('husky.button.instance.state', 'disable'); | ||
|
||
_.delay(function() { | ||
flag = true; | ||
}, 500); | ||
}); | ||
|
||
waitsFor(function() { | ||
return flag; | ||
}, 'load component', 500); | ||
|
||
runs(function() { | ||
expect($('.icon-btn.disable').size()).toBe(1); | ||
}); | ||
}); | ||
}); | ||
}); |