});
-
+
test("exec", function () {
QUnit.reset();
</video>
*/
+module("Popcorn Locale");
+
+test( "Popcorn.locale object", function() {
+
+ var api = {
+ get: "function",
+ set: "function",
+ broadcast: "function"
+ },
+ locale = navigator.language,
+ parts = locale.split("-"),
+
+ stub = {
+ i18n: locale,
+ language: parts[ 0 ],
+ region: parts[ 1 ]
+ },
+ $pop = Popcorn("#video"),
+ expects = 12,
+ count = 0;
+
+ expect( expects );
+
+ function plus() {
+ if ( ++count == expects ) {
+ start();
+ }
+ }
+
+ stop( 10000 );
+
+ ok( Popcorn.locale, "Popcorn.locale exists");
+ plus();
+
+ equal( typeof Popcorn.locale, "object", "Popcorn.locale is an object");
+ plus();
+
+ Popcorn.forEach( api, function( type, method ) {
+ ok( Popcorn.locale[ method ], Popcorn.locale[ method ] + " exists" );
+ plus();
+ equal( typeof Popcorn.locale[ method ], type, Popcorn.locale[ method ] + " is a " + type );
+ plus();
+ });
+
+ deepEqual( Popcorn.locale.get(), stub, "Popcorn.locale.get() === navigator.language (" + JSON.stringify(stub) + ") whenever possible" );
+ plus();
+
+ Popcorn.forEach( Popcorn.locale.get(), function( val, prop ) {
+ equal( val, stub[ prop ], "locale matches stub" );
+ plus();
+ });
+
+
+ Popcorn.locale.set("fr-CA");
+
+
+ $pop.listen("locale:changed", function() {
+
+ var locale = "fr-CA",
+ parts = locale.split("-"),
+ stub = {
+ i18n: locale,
+ language: parts[ 0 ],
+ region: parts[ 1 ]
+ };
+
+ Popcorn.forEach( Popcorn.locale.get(), function( val, prop ) {
+ equal( val, stub[ prop ], "locale matches updated stub" );
+ plus();
+ });
+ });
+
+
+});
+
module("Popcorn Position");
test("position", function () {
end: function() {}
});
- $pop.zero({
- start:0,
- end: 2
+ $pop.zero({
+ start:0,
+ end: 2
});
});
test("Update Timer", function () {