changes to the unit tests.
--- a/unittests/index.html Thu Oct 13 17:12:52 2011 +0200
+++ b/unittests/index.html Thu Oct 13 17:13:44 2011 +0200
@@ -1,7 +1,13 @@
<html>
<head>
<title>Unit Tests</title>
+ <!-- the following libs are included only for unit testing -->
<script src="../res/js/jquery.min.js"></script>
+ <script src="../res/js/jquery.tools.min.js"></script>
+ <script src="../res/js/jquery-ui.min.js"></script>
+ <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/base/jquery-ui.css" type="text/css" media="screen" />
+ <!-- -->
+
<script src="../build/LdtPlayer-release.js"></script>
<script src="qunit.js" type="text/javascript"></script>
<script src="sinon.js" type="text/javascript"></script>
@@ -12,17 +18,20 @@
<script src="tests/serializer.js" type="text/javascript"></script>
<script src="tests/JSONSerializer.js" type="text/javascript"></script>
<script src="tests/serializerFactory.js" type="text/javascript"></script>
+ <script src="tests/widget.js" type="text/javascript"></script>
+ <script src="tests/playerWidget.js" type="text/javascript"></script>
</head>
<script>
- $(document).ready(function(){
+ $(document).ready(function(){
/* only for unit-testing ! */
IriSP.jQuery = jQuery;
-
test_dataloader();
test_serializer();
test_JSONSerializer();
- test_serializerFactory()
+ test_serializerFactory();
+ test_widget();
+ test_player_widget();
});
</script>
<body>
@@ -31,6 +40,9 @@
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
- <div id="qunit-fixture">test markup, will be hidden</div>
+ <div id="qunit-fixture" style="position: float;">
+ <div id='popcorn-div'>Popcorn div</div>
+ <div id='widget-div'></div>
+ </div>
</body>
</html>
\ No newline at end of file
--- a/unittests/tests/JSONSerializer.js Thu Oct 13 17:12:52 2011 +0200
+++ b/unittests/tests/JSONSerializer.js Thu Oct 13 17:13:44 2011 +0200
@@ -13,7 +13,7 @@
equal(serializer.serialize(arr), JSON.stringify(arr), "assert that the outputted json is correct");
});
- test("sync() - callback should get called", function() {
+ test("sync()", function() {
this.xhr = this.sandbox.useFakeXMLHttpRequest();
this.requests = [];
this.xhr.onCreate = function (request) {
@@ -37,4 +37,11 @@
deepEqual(ser._data, response_array, "the internal variable is initialized to the correct value");
});
+ test("currentMedia should return the current media", function() {
+ var ser = new IriSP.JSONSerializer(this.dt, "/url");
+ /* FIXME: actually get something instead of monkey-patching the struct */
+ ser._data = {}
+ ser._data.medias = [0];
+ equal(ser.currentMedia(), 0, "currentMedia() returns the correct value");
+ });
};
\ No newline at end of file
--- a/unittests/tests/dataloader.js Thu Oct 13 17:12:52 2011 +0200
+++ b/unittests/tests/dataloader.js Thu Oct 13 17:13:44 2011 +0200
@@ -34,7 +34,9 @@
ok(spy_callback.calledOnce, "callback called");
ok(spy_callback.calledWith(response_array), "callback called with correct string");
- deepEqual(dt._cache["/url"], response_array, "the response should be stored in the cache");
+
+ // FIXME : remove or activate this test.
+ //deepEqual(dt._cache["/url"], response_array, "the response should be stored in the cache");
});
}
\ No newline at end of file