mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-11 02:30:28 +00:00
07df513140
Testing against the output of cook.rb isn't satisfactory because of the bugs in it; instead we're now going to test against the tiddlywiki.com build products
40 lines
1.1 KiB
JavaScript
Executable File
40 lines
1.1 KiB
JavaScript
Executable File
// <![CDATA[
|
|
function getMessage() {
|
|
return msgArea.getElementsByTagName("div")[1].innerHTML;
|
|
}
|
|
|
|
describe('displayMessage',
|
|
{
|
|
before_each: function() {
|
|
msgArea = createTiddlyElement(document.body,"div","messageArea");
|
|
msgArea.style.visibility = "hidden"; },
|
|
after_each: function() {
|
|
removeNode(msgArea);
|
|
},
|
|
'should raise an alert if the messageArea element does not exist': function() {
|
|
msgArea.id = "messageArea_disabled";
|
|
var text = "alert this text!";
|
|
tests_mock.before('alert', function() {
|
|
tests_mock.frame['alert'].args = arguments;
|
|
});
|
|
displayMessage(text);
|
|
frame = tests_mock.after('alert');
|
|
value_of(frame.called).should_be(1);
|
|
value_of(frame.args[0]).should_be(text);
|
|
},
|
|
'should put single letter "s" into the message area': function() {
|
|
var text = "s";
|
|
displayMessage(text);
|
|
var actual = getMessage();
|
|
value_of(actual).should_be(text);
|
|
},
|
|
'should put text into the message area': function() {
|
|
var text = "The quick brown fox jumps over the lazy dog";
|
|
displayMessage(text);
|
|
var actual = getMessage();
|
|
value_of(actual).should_be(text);
|
|
}
|
|
});
|
|
|
|
// ]]>
|