From eb19f53c2670f7f1cd9dfd9c669102d1693dea17 Mon Sep 17 00:00:00 2001 From: John Bender Date: Tue, 23 Nov 2010 11:35:20 +0800 Subject: [PATCH] added test for grade a check --- tests/unit/core/core.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/tests/unit/core/core.js b/tests/unit/core/core.js index 923f8591..b4d7e749 100644 --- a/tests/unit/core/core.js +++ b/tests/unit/core/core.js @@ -6,7 +6,11 @@ var libName = "jquery.mobile.core.js", setGradeA = function(value) { $.support.mediaquery = value; }; - module(libName); + module(libName, { + setup: function(){ + $('html').removeClass('ui-mobile'); + } + }); $.testHelper.excludeFileProtocol(function(){ @@ -29,5 +33,20 @@ $.testHelper.reloadLib(libName); }); + + test("enhancments are skipped when the browser is not grade A", function(){ + setGradeA(false); + $.testHelper.reloadLib(libName); + + //NOTE easiest way to check for enhancements, not the most obvious + ok(!$("html").hasClass("ui-mobile")); + }); + + test("enhancments are added when the browser is not grade A", function(){ + setGradeA(true); + $.testHelper.reloadLib(libName); + + ok($("html").hasClass("ui-mobile")); + }); }); })(jQuery); \ No newline at end of file