Created
April 27, 2011 23:45
-
-
Save dukex/945489 to your computer and use it in GitHub Desktop.
qUnit Vs Jasmine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe("accessibility", function () { | |
beforeEach(function(){ | |
var ac = $('#menu1').menu(); | |
var item0 = $("li:eq(0) a"); | |
}); | |
it("should has menu class", function(){ | |
expect(ac.hasClass("ui-menu ui-widget ui-widget-content ui-corner-all")).toEqual(true); | |
}); | |
it("should has role listbox", function(){ | |
expect(ac.attr("role")).toEqual("listbox"); | |
}); | |
it("should not has aria-activedescendant", function(){ | |
expect(ac.attr("aria-activedescendant")).not.toEqual(true) | |
}); | |
it("should add aria attribute for id from dom", function(){ | |
var item = ac.find( "li:first" ).find( "a" ).attr( "id", "xid" ).end(); | |
ac.menu( "focus", $.Event(), item ); | |
expect( ac.attr("aria-activedescendant")).toEqual("xid"); | |
}); | |
it("should add aria attribute for generated id"), function(){ | |
var item = ac.find( "li:last" ); | |
ac.menu( "focus", $.Event(), item ); | |
expect( ac.attr("aria-activedescendant")).toEqual("menu1-activedescendant"); | |
}); | |
}); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test("accessibility", function () { | |
expect(5); | |
var ac = $('#menu1').menu(); | |
var item0 = $("li:eq(0) a"); | |
ok( ac.hasClass("ui-menu ui-widget ui-widget-content ui-corner-all"), "menu class"); | |
equals( ac.attr("role"), "listbox", "main role"); | |
ok( !ac.attr("aria-activedescendant"), "aria attribute not yet active"); | |
var item = ac.find( "li:first" ).find( "a" ).attr( "id", "xid" ).end(); | |
ac.menu( "focus", $.Event(), item ); | |
equals( ac.attr("aria-activedescendant"), "xid", "aria attribute, id from dom"); | |
var item = ac.find( "li:last" ); | |
ac.menu( "focus", $.Event(), item ); | |
equals( ac.attr("aria-activedescendant"), "menu1-activedescendant", "aria attribute, generated id"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Prefiro TDD ;D