1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-07 18:39:57 +00:00
TiddlyWiki5/tw2/source/tiddlywiki/tests/jsspec/Messages.jsspec.js
Jeremy Ruston a1c8ac624f Added first pass at support for building TiddlyWiki 2.6.x with TW5
There are still some whitespace and attribute ordering issues, but the
result runs correctly.
2012-05-29 22:02:38 +01:00

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);
}
});
// ]]>