Add test.html for loading tests in browser and tests_main.js for calling them

Also add flush method to converse.js (used in ClientStorage tests)
This commit is contained in:
JC Brand 2012-12-08 07:24:34 +02:00
parent da71c0b7f2
commit 85e419afc5
3 changed files with 43 additions and 2 deletions

View File

@ -229,6 +229,12 @@
chats.splice(_.indexOf(chats, jid), 1);
}
store.set(key, chats);
},
flush: function () {
// Clears all localstorage content handled by burry.js
// Only used in tests
store.flush();
}
});
@ -370,8 +376,6 @@
$content = this.$el.find('.chat-content'),
prev_date, this_date, now, separator, i;
for (i=0; i<_.size(msgs); i++) {
var msg = msgs[i],
msg_array = msg.split(' ', 2),
@ -1822,5 +1826,7 @@
}
}, this));
}, xmppchat));
return xmppchat;
}));

18
tests.html Normal file
View File

@ -0,0 +1,18 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Converse.js Tests</title>
<link rel="shortcut icon" type="image/png" href="Libraries/jasmine-1.3.1/jasmine_favicon.png">
<link rel="stylesheet" type="text/css" href="Libraries/jasmine-1.3.1/jasmine.css">
<script type="text/javascript" src="Libraries/jasmine-1.3.1/jasmine.js"></script>
<script type="text/javascript" src="Libraries/jasmine-1.3.1/jasmine-html.js"></script>
<!-- include source files here... -->
<script data-main="tests_main" src="Libraries/require-jquery.js"></script>
</head>
<body>
</body>
</html>

17
tests_main.js Normal file
View File

@ -0,0 +1,17 @@
require(["jquery",
"spec/StorageSpec"], function($) {
$(function($) {
var jasmineEnv = jasmine.getEnv();
jasmineEnv.updateInterval = 1000;
var htmlReporter = new jasmine.HtmlReporter();
jasmineEnv.addReporter(htmlReporter);
jasmineEnv.specFilter = function(spec) {
return htmlReporter.specFilter(spec);
};
jasmineEnv.execute();
});
});