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:
parent
da71c0b7f2
commit
85e419afc5
10
converse.js
10
converse.js
@ -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
18
tests.html
Normal 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
17
tests_main.js
Normal 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();
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user