diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /accessible/tests/mochitest/role | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | accessible/tests/mochitest/role.js | 198 | ||||
-rw-r--r-- | accessible/tests/mochitest/role/a11y.toml | 19 | ||||
-rw-r--r-- | accessible/tests/mochitest/role/chrome_body_role_alert.xhtml | 6 | ||||
-rw-r--r-- | accessible/tests/mochitest/role/test_aria.html | 729 | ||||
-rw-r--r-- | accessible/tests/mochitest/role/test_aria.xhtml | 65 | ||||
-rw-r--r-- | accessible/tests/mochitest/role/test_dpub_aria.html | 114 | ||||
-rw-r--r-- | accessible/tests/mochitest/role/test_general.html | 201 | ||||
-rw-r--r-- | accessible/tests/mochitest/role/test_general.xhtml | 59 | ||||
-rw-r--r-- | accessible/tests/mochitest/role/test_graphics_aria.html | 42 | ||||
-rw-r--r-- | accessible/tests/mochitest/role/test_svg.html | 93 |
10 files changed, 1526 insertions, 0 deletions
diff --git a/accessible/tests/mochitest/role.js b/accessible/tests/mochitest/role.js new file mode 100644 index 0000000000..07b820c2ac --- /dev/null +++ b/accessible/tests/mochitest/role.js @@ -0,0 +1,198 @@ +/* import-globals-from common.js */ + +// ////////////////////////////////////////////////////////////////////////////// +// Role constants + +const ROLE_ALERT = nsIAccessibleRole.ROLE_ALERT; +const ROLE_ARTICLE = nsIAccessibleRole.ROLE_ARTICLE; +const ROLE_ANIMATION = nsIAccessibleRole.ROLE_ANIMATION; +const ROLE_APPLICATION = nsIAccessibleRole.ROLE_APPLICATION; +const ROLE_APP_ROOT = nsIAccessibleRole.ROLE_APP_ROOT; +const ROLE_BLOCKQUOTE = nsIAccessibleRole.ROLE_BLOCKQUOTE; +const ROLE_BUTTONMENU = nsIAccessibleRole.ROLE_BUTTONMENU; +const ROLE_CANVAS = nsIAccessibleRole.ROLE_CANVAS; +const ROLE_CAPTION = nsIAccessibleRole.ROLE_CAPTION; +const ROLE_CELL = nsIAccessibleRole.ROLE_CELL; +const ROLE_CHECKBUTTON = nsIAccessibleRole.ROLE_CHECKBUTTON; +const ROLE_CHECK_MENU_ITEM = nsIAccessibleRole.ROLE_CHECK_MENU_ITEM; +const ROLE_CHROME_WINDOW = nsIAccessibleRole.ROLE_CHROME_WINDOW; +const ROLE_CODE = nsIAccessibleRole.ROLE_CODE; +const ROLE_COLUMNHEADER = nsIAccessibleRole.ROLE_COLUMNHEADER; +const ROLE_COMBOBOX = nsIAccessibleRole.ROLE_COMBOBOX; +const ROLE_COMBOBOX_LIST = nsIAccessibleRole.ROLE_COMBOBOX_LIST; +const ROLE_COMBOBOX_OPTION = nsIAccessibleRole.ROLE_COMBOBOX_OPTION; +const ROLE_COMMENT = nsIAccessibleRole.ROLE_COMMENT; +const ROLE_CONTENT_DELETION = nsIAccessibleRole.ROLE_CONTENT_DELETION; +const ROLE_CONTENT_INSERTION = nsIAccessibleRole.ROLE_CONTENT_INSERTION; +const ROLE_DATE_EDITOR = nsIAccessibleRole.ROLE_DATE_EDITOR; +const ROLE_DEFINITION = nsIAccessibleRole.ROLE_DEFINITION; +const ROLE_DEFINITION_LIST = nsIAccessibleRole.ROLE_DEFINITION_LIST; +const ROLE_DETAILS = nsIAccessibleRole.ROLE_DETAILS; +const ROLE_DIAGRAM = nsIAccessibleRole.ROLE_DIAGRAM; +const ROLE_DIALOG = nsIAccessibleRole.ROLE_DIALOG; +const ROLE_DOCUMENT = nsIAccessibleRole.ROLE_DOCUMENT; +const ROLE_EDITCOMBOBOX = nsIAccessibleRole.ROLE_EDITCOMBOBOX; +const ROLE_EMPHASIS = nsIAccessibleRole.ROLE_EMPHASIS; +const ROLE_ENTRY = nsIAccessibleRole.ROLE_ENTRY; +const ROLE_FIGURE = nsIAccessibleRole.ROLE_FIGURE; +const ROLE_FOOTNOTE = nsIAccessibleRole.ROLE_FOOTNOTE; +const ROLE_FLAT_EQUATION = nsIAccessibleRole.ROLE_FLAT_EQUATION; +const ROLE_FORM = nsIAccessibleRole.ROLE_FORM; +const ROLE_FORM_LANDMARK = nsIAccessibleRole.ROLE_FORM_LANDMARK; +const ROLE_GRAPHIC = nsIAccessibleRole.ROLE_GRAPHIC; +const ROLE_GRID_CELL = nsIAccessibleRole.ROLE_GRID_CELL; +const ROLE_GROUPING = nsIAccessibleRole.ROLE_GROUPING; +const ROLE_HEADING = nsIAccessibleRole.ROLE_HEADING; +const ROLE_IMAGE_MAP = nsIAccessibleRole.ROLE_IMAGE_MAP; +const ROLE_INTERNAL_FRAME = nsIAccessibleRole.ROLE_INTERNAL_FRAME; +const ROLE_LABEL = nsIAccessibleRole.ROLE_LABEL; +const ROLE_LANDMARK = nsIAccessibleRole.ROLE_LANDMARK; +const ROLE_LINK = nsIAccessibleRole.ROLE_LINK; +const ROLE_LIST = nsIAccessibleRole.ROLE_LIST; +const ROLE_LISTBOX = nsIAccessibleRole.ROLE_LISTBOX; +const ROLE_LISTITEM = nsIAccessibleRole.ROLE_LISTITEM; +const ROLE_LISTITEM_MARKER = nsIAccessibleRole.ROLE_LISTITEM_MARKER; +const ROLE_MARK = nsIAccessibleRole.ROLE_MARK; +const ROLE_MATHML_MATH = nsIAccessibleRole.ROLE_MATHML_MATH; +const ROLE_MATHML_IDENTIFIER = nsIAccessibleRole.ROLE_MATHML_IDENTIFIER; +const ROLE_MATHML_NUMBER = nsIAccessibleRole.ROLE_MATHML_NUMBER; +const ROLE_MATHML_OPERATOR = nsIAccessibleRole.ROLE_MATHML_OPERATOR; +const ROLE_MATHML_TEXT = nsIAccessibleRole.ROLE_MATHML_TEXT; +const ROLE_MATHML_STRING_LITERAL = nsIAccessibleRole.ROLE_MATHML_STRING_LITERAL; +const ROLE_MATHML_GLYPH = nsIAccessibleRole.ROLE_MATHML_GLYPH; +const ROLE_MATHML_ROW = nsIAccessibleRole.ROLE_MATHML_ROW; +const ROLE_MATHML_FRACTION = nsIAccessibleRole.ROLE_MATHML_FRACTION; +const ROLE_MATHML_SQUARE_ROOT = nsIAccessibleRole.ROLE_MATHML_SQUARE_ROOT; +const ROLE_MATHML_ROOT = nsIAccessibleRole.ROLE_MATHML_ROOT; +const ROLE_MATHML_FENCED = nsIAccessibleRole.ROLE_MATHML_FENCED; +const ROLE_MATHML_ENCLOSED = nsIAccessibleRole.ROLE_MATHML_ENCLOSED; +const ROLE_MATHML_STYLE = nsIAccessibleRole.ROLE_MATHML_STYLE; +const ROLE_MATHML_SUB = nsIAccessibleRole.ROLE_MATHML_SUB; +const ROLE_MATHML_SUP = nsIAccessibleRole.ROLE_MATHML_SUP; +const ROLE_MATHML_SUB_SUP = nsIAccessibleRole.ROLE_MATHML_SUB_SUP; +const ROLE_MATHML_UNDER = nsIAccessibleRole.ROLE_MATHML_UNDER; +const ROLE_MATHML_OVER = nsIAccessibleRole.ROLE_MATHML_OVER; +const ROLE_MATHML_UNDER_OVER = nsIAccessibleRole.ROLE_MATHML_UNDER_OVER; +const ROLE_MATHML_MULTISCRIPTS = nsIAccessibleRole.ROLE_MATHML_MULTISCRIPTS; +const ROLE_MATHML_TABLE = nsIAccessibleRole.ROLE_MATHML_TABLE; +const ROLE_MATHML_LABELED_ROW = nsIAccessibleRole.ROLE_MATHML_LABELED_ROW; +const ROLE_MATHML_TABLE_ROW = nsIAccessibleRole.ROLE_MATHML_TABLE_ROW; +const ROLE_MATHML_CELL = nsIAccessibleRole.ROLE_MATHML_CELL; +const ROLE_MATHML_ACTION = nsIAccessibleRole.ROLE_MATHML_ACTION; +const ROLE_MATHML_ERROR = nsIAccessibleRole.ROLE_MATHML_ERROR; +const ROLE_MATHML_STACK = nsIAccessibleRole.ROLE_MATHML_STACK; +const ROLE_MATHML_LONG_DIVISION = nsIAccessibleRole.ROLE_MATHML_LONG_DIVISION; +const ROLE_MATHML_STACK_GROUP = nsIAccessibleRole.ROLE_MATHML_STACK_GROUP; +const ROLE_MATHML_STACK_ROW = nsIAccessibleRole.ROLE_MATHML_STACK_ROW; +const ROLE_MATHML_STACK_CARRIES = nsIAccessibleRole.ROLE_MATHML_STACK_CARRIES; +const ROLE_MATHML_STACK_CARRY = nsIAccessibleRole.ROLE_MATHML_STACK_CARRY; +const ROLE_MATHML_STACK_LINE = nsIAccessibleRole.ROLE_MATHML_STACK_LINE; +const ROLE_MENUBAR = nsIAccessibleRole.ROLE_MENUBAR; +const ROLE_MENUITEM = nsIAccessibleRole.ROLE_MENUITEM; +const ROLE_MENUPOPUP = nsIAccessibleRole.ROLE_MENUPOPUP; +const ROLE_METER = nsIAccessibleRole.ROLE_METER; +const ROLE_NAVIGATION = nsIAccessibleRole.ROLE_NAVIGATION; +const ROLE_NON_NATIVE_DOCUMENT = nsIAccessibleRole.ROLE_NON_NATIVE_DOCUMENT; +const ROLE_NOTHING = nsIAccessibleRole.ROLE_NOTHING; +const ROLE_NOTE = nsIAccessibleRole.ROLE_NOTE; +const ROLE_OPTION = nsIAccessibleRole.ROLE_OPTION; +const ROLE_OUTLINE = nsIAccessibleRole.ROLE_OUTLINE; +const ROLE_OUTLINEITEM = nsIAccessibleRole.ROLE_OUTLINEITEM; +const ROLE_PAGETAB = nsIAccessibleRole.ROLE_PAGETAB; +const ROLE_PAGETABLIST = nsIAccessibleRole.ROLE_PAGETABLIST; +const ROLE_PANE = nsIAccessibleRole.ROLE_PANE; +const ROLE_PARAGRAPH = nsIAccessibleRole.ROLE_PARAGRAPH; +const ROLE_PARENT_MENUITEM = nsIAccessibleRole.ROLE_PARENT_MENUITEM; +const ROLE_PASSWORD_TEXT = nsIAccessibleRole.ROLE_PASSWORD_TEXT; +const ROLE_PROGRESSBAR = nsIAccessibleRole.ROLE_PROGRESSBAR; +const ROLE_PROPERTYPAGE = nsIAccessibleRole.ROLE_PROPERTYPAGE; +const ROLE_PUSHBUTTON = nsIAccessibleRole.ROLE_PUSHBUTTON; +const ROLE_RADIOBUTTON = nsIAccessibleRole.ROLE_RADIOBUTTON; +const ROLE_RADIO_GROUP = nsIAccessibleRole.ROLE_RADIO_GROUP; +const ROLE_RADIO_MENU_ITEM = nsIAccessibleRole.ROLE_RADIO_MENU_ITEM; +const ROLE_REGION = nsIAccessibleRole.ROLE_REGION; +const ROLE_RICH_OPTION = nsIAccessibleRole.ROLE_RICH_OPTION; +const ROLE_ROW = nsIAccessibleRole.ROLE_ROW; +const ROLE_ROWHEADER = nsIAccessibleRole.ROLE_ROWHEADER; +const ROLE_SCROLLBAR = nsIAccessibleRole.ROLE_SCROLLBAR; +const ROLE_SECTION = nsIAccessibleRole.ROLE_SECTION; +const ROLE_SEPARATOR = nsIAccessibleRole.ROLE_SEPARATOR; +const ROLE_SLIDER = nsIAccessibleRole.ROLE_SLIDER; +const ROLE_SPINBUTTON = nsIAccessibleRole.ROLE_SPINBUTTON; +const ROLE_STATICTEXT = nsIAccessibleRole.ROLE_STATICTEXT; +const ROLE_STATUSBAR = nsIAccessibleRole.ROLE_STATUSBAR; +const ROLE_STRONG = nsIAccessibleRole.ROLE_STRONG; +const ROLE_SUBSCRIPT = nsIAccessibleRole.ROLE_SUBSCRIPT; +const ROLE_SUGGESTION = nsIAccessibleRole.ROLE_SUGGESTION; +const ROLE_SUPERSCRIPT = nsIAccessibleRole.ROLE_SUPERSCRIPT; +const ROLE_SUMMARY = nsIAccessibleRole.ROLE_SUMMARY; +const ROLE_SWITCH = nsIAccessibleRole.ROLE_SWITCH; +const ROLE_TABLE = nsIAccessibleRole.ROLE_TABLE; +const ROLE_TERM = nsIAccessibleRole.ROLE_TERM; +const ROLE_TEXT = nsIAccessibleRole.ROLE_TEXT; +const ROLE_TEXT_CONTAINER = nsIAccessibleRole.ROLE_TEXT_CONTAINER; +const ROLE_TEXT_LEAF = nsIAccessibleRole.ROLE_TEXT_LEAF; +const ROLE_TIME = nsIAccessibleRole.ROLE_TIME; +const ROLE_TIME_EDITOR = nsIAccessibleRole.ROLE_TIME_EDITOR; +const ROLE_TOGGLE_BUTTON = nsIAccessibleRole.ROLE_TOGGLE_BUTTON; +const ROLE_TOOLBAR = nsIAccessibleRole.ROLE_TOOLBAR; +const ROLE_TOOLTIP = nsIAccessibleRole.ROLE_TOOLTIP; +const ROLE_TREE_TABLE = nsIAccessibleRole.ROLE_TREE_TABLE; +const ROLE_WHITESPACE = nsIAccessibleRole.ROLE_WHITESPACE; + +// ////////////////////////////////////////////////////////////////////////////// +// Public methods + +/** + * Test that the role of the given accessible is the role passed in. + * + * @param aAccOrElmOrID the accessible, DOM element or ID to be tested. + * @param aRole The role that is to be expected. + */ +function testRole(aAccOrElmOrID, aRole) { + var role = getRole(aAccOrElmOrID); + is(role, aRole, "Wrong role for " + prettyName(aAccOrElmOrID) + "!"); +} + +/** + * Return the role of the given accessible. Return -1 if accessible could not + * be retrieved. + * + * @param aAccOrElmOrID [in] The accessible, DOM element or element ID the + * accessible role is being requested for. + */ +function getRole(aAccOrElmOrID) { + var acc = getAccessible(aAccOrElmOrID); + if (!acc) { + return -1; + } + + var role = -1; + try { + role = acc.role; + } catch (e) { + ok(false, "Role for " + aAccOrElmOrID + " could not be retrieved!"); + } + + return role; +} + +/** + * Analogy of SimpleTest.is function used to check the role. + */ +function isRole(aIdentifier, aRole, aMsg) { + var role = getRole(aIdentifier); + if (role == -1) { + return; + } + + if (role == aRole) { + ok(true, aMsg); + return; + } + + var got = roleToString(role); + var expected = roleToString(aRole); + + ok(false, aMsg + "got '" + got + "', expected '" + expected + "'"); +} diff --git a/accessible/tests/mochitest/role/a11y.toml b/accessible/tests/mochitest/role/a11y.toml new file mode 100644 index 0000000000..8febfc3bd7 --- /dev/null +++ b/accessible/tests/mochitest/role/a11y.toml @@ -0,0 +1,19 @@ +[DEFAULT] +support-files = [ + "chrome_body_role_alert.xhtml", + "!/accessible/tests/mochitest/*.js", + "!/accessible/tests/mochitest/moz.png"] + +["test_aria.html"] + +["test_aria.xhtml"] + +["test_dpub_aria.html"] + +["test_general.html"] + +["test_general.xhtml"] + +["test_graphics_aria.html"] + +["test_svg.html"] diff --git a/accessible/tests/mochitest/role/chrome_body_role_alert.xhtml b/accessible/tests/mochitest/role/chrome_body_role_alert.xhtml new file mode 100644 index 0000000000..29ff10fb01 --- /dev/null +++ b/accessible/tests/mochitest/role/chrome_body_role_alert.xhtml @@ -0,0 +1,6 @@ +<?xml version="1.0"?> +<!DOCTYPE html> +<html xmlns="http://www.w3.org/1999/xhtml"> + <body role="alert"> + </body> +</html> diff --git a/accessible/tests/mochitest/role/test_aria.html b/accessible/tests/mochitest/role/test_aria.html new file mode 100644 index 0000000000..bd7ffd27fb --- /dev/null +++ b/accessible/tests/mochitest/role/test_aria.html @@ -0,0 +1,729 @@ +<!DOCTYPE html> +<html> +<head> + <title>Test weak ARIA roles</title> + + <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" /> + + <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> + + <script type="application/javascript" + src="../common.js"></script> + <script type="application/javascript" + src="../role.js"></script> + + <script type="application/javascript"> + + // To test initial roles on body elements, we need to use an iframe. + function testBodyRole(iframeId, role) { + let iframe = getNode(iframeId); + let doc = iframe.contentDocument; + let docAcc = getAccessible(doc); + testRole(docAcc, role); + } + + async function doTest() { + // ARIA role map. + testRole("aria_alert", ROLE_ALERT); + testRole("aria_alert_mixed", ROLE_ALERT); + testRole("aria_alertdialog", ROLE_DIALOG); + testRole("aria_alertdialog_mixed", ROLE_DIALOG); + testRole("aria_application", ROLE_APPLICATION); + testRole("aria_application_mixed", ROLE_APPLICATION); + testRole("aria_article", ROLE_ARTICLE); + testRole("aria_article_mixed", ROLE_ARTICLE); + testRole("aria_blockquote", ROLE_BLOCKQUOTE); + testRole("aria_blockquote_mixed", ROLE_BLOCKQUOTE); + testRole("aria_button", ROLE_PUSHBUTTON); + testRole("aria_button_mixed", ROLE_PUSHBUTTON); + testRole("aria_caption", ROLE_CAPTION); + testRole("aria_caption_mixed", ROLE_CAPTION); + testRole("aria_checkbox", ROLE_CHECKBUTTON); + testRole("aria_checkbox_mixed", ROLE_CHECKBUTTON); + testRole("aria_code", ROLE_CODE); + testRole("aria_code_mixed", ROLE_CODE); + testRole("aria_columnheader", ROLE_COLUMNHEADER); + testRole("aria_columnheader_mixed", ROLE_COLUMNHEADER); + testRole("aria_combobox", ROLE_EDITCOMBOBOX); + testRole("aria_combobox_mixed", ROLE_EDITCOMBOBOX); + testRole("aria_comment", ROLE_COMMENT); + testRole("aria_comment_mixed", ROLE_COMMENT); + testRole("aria_deletion", ROLE_CONTENT_DELETION); + testRole("aria_deletion_mixed", ROLE_CONTENT_DELETION); + testRole("aria_dialog", ROLE_DIALOG); + testRole("aria_dialog_mixed", ROLE_DIALOG); + testRole("aria_directory", ROLE_LIST); + testRole("aria_directory_mixed", ROLE_LIST); + testRole("aria_document", ROLE_NON_NATIVE_DOCUMENT); + testRole("aria_document_mixed", ROLE_NON_NATIVE_DOCUMENT); + testRole("aria_form", ROLE_FORM); + testRole("aria_form_mixed", ROLE_FORM); + testRole("aria_form_with_label", ROLE_FORM); + testRole("aria_form_with_label_mixed", ROLE_FORM); + testRole("aria_feed", ROLE_GROUPING); + testRole("aria_feed_mixed", ROLE_GROUPING); + testRole("aria_figure", ROLE_FIGURE); + testRole("aria_figure_mixed", ROLE_FIGURE); + testRole("aria_grid", ROLE_TABLE); + testRole("aria_grid_mixed", ROLE_TABLE); + testRole("aria_gridcell", ROLE_GRID_CELL); + testRole("aria_gridcell_mixed", ROLE_GRID_CELL); + testRole("aria_group", ROLE_GROUPING); + testRole("aria_group_mixed", ROLE_GROUPING); + testRole("aria_heading", ROLE_HEADING); + testRole("aria_heading_mixed", ROLE_HEADING); + testRole("aria_img", ROLE_GRAPHIC); + testRole("aria_img_mixed", ROLE_GRAPHIC); + testRole("aria_insertion", ROLE_CONTENT_INSERTION); + testRole("aria_insertion_mixed", ROLE_CONTENT_INSERTION); + testRole("aria_link", ROLE_LINK); + testRole("aria_link_mixed", ROLE_LINK); + testRole("aria_list", ROLE_LIST); + testRole("aria_list_mixed", ROLE_LIST); + testRole("aria_listbox", ROLE_LISTBOX); + testRole("aria_listbox_mixed", ROLE_LISTBOX); + testRole("aria_listitem", ROLE_LISTITEM); + testRole("aria_listitem_mixed", ROLE_LISTITEM); + testRole("aria_log", ROLE_TEXT); // weak role + testRole("aria_log_mixed", ROLE_TEXT); // weak role + testRole("aria_mark", ROLE_MARK); + testRole("aria_mark_mixed", ROLE_MARK); + testRole("aria_marquee", ROLE_ANIMATION); + testRole("aria_marquee_mixed", ROLE_ANIMATION); + testRole("aria_math", ROLE_FLAT_EQUATION); + testRole("aria_math_mixed", ROLE_FLAT_EQUATION); + testRole("aria_menu", ROLE_MENUPOPUP); + testRole("aria_menu_mixed", ROLE_MENUPOPUP); + testRole("aria_menubar", ROLE_MENUBAR); + testRole("aria_menubar_mixed", ROLE_MENUBAR); + testRole("aria_menuitem", ROLE_MENUITEM); + testRole("aria_menuitem_mixed", ROLE_MENUITEM); + testRole("aria_menuitemcheckbox", ROLE_CHECK_MENU_ITEM); + testRole("aria_menuitemcheckbox_mixed", ROLE_CHECK_MENU_ITEM); + testRole("aria_menuitemradio", ROLE_RADIO_MENU_ITEM); + testRole("aria_menuitemradio_mixed", ROLE_RADIO_MENU_ITEM); + testRole("aria_meter", ROLE_METER); + testRole("aria_meter_mixed", ROLE_METER); + testRole("aria_note", ROLE_NOTE); + testRole("aria_note_mixed", ROLE_NOTE); + testRole("aria_paragraph", ROLE_PARAGRAPH); + testRole("aria_paragraph_mixed", ROLE_PARAGRAPH); + testRole("aria_presentation", ROLE_TEXT); // weak role + testRole("aria_presentation_mixed", ROLE_TEXT); // weak role + testRole("aria_progressbar", ROLE_PROGRESSBAR); + testRole("aria_progressbar_mixed", ROLE_PROGRESSBAR); + testRole("aria_radio", ROLE_RADIOBUTTON); + testRole("aria_radio_mixed", ROLE_RADIOBUTTON); + testRole("aria_radiogroup", ROLE_RADIO_GROUP); + testRole("aria_radiogroup_mixed", ROLE_RADIO_GROUP); + testRole("aria_region_no_name", ROLE_TEXT); + testRole("aria_region_no_name_mixed", ROLE_TEXT); + testRole("aria_region_has_label", ROLE_REGION); + testRole("aria_region_has_label_mixed", ROLE_REGION); + testRole("aria_region_has_labelledby", ROLE_REGION); + testRole("aria_region_has_labelledby_mixed", ROLE_REGION); + testRole("aria_region_has_title", ROLE_REGION); + testRole("aria_region_has_title_mixed", ROLE_REGION); + testRole("aria_region_empty_name", ROLE_TEXT); + testRole("aria_region_empty_name_mixed", ROLE_TEXT); + testRole("aria_region_as_table_with_caption", ROLE_REGION); + testRole("aria_region_as_table_with_caption_mixed", ROLE_REGION); + testRole("aria_region_as_table_with_miscaption", ROLE_TABLE); + testRole("aria_region_as_table_with_miscaption_mixed", ROLE_TABLE); + testRole("aria_row", ROLE_ROW); + testRole("aria_row_mixed", ROLE_ROW); + testRole("aria_rowheader", ROLE_ROWHEADER); + testRole("aria_rowheader_mixed", ROLE_ROWHEADER); + testRole("aria_scrollbar", ROLE_SCROLLBAR); + testRole("aria_scrollbar_mixed", ROLE_SCROLLBAR); + testRole("aria_searchbox", ROLE_ENTRY); + testRole("aria_searchbox_mixed", ROLE_ENTRY); + testRole("aria_separator", ROLE_SEPARATOR); + testRole("aria_separator_mixed", ROLE_SEPARATOR); + testRole("aria_slider", ROLE_SLIDER); + testRole("aria_slider_mixed", ROLE_SLIDER); + testRole("aria_spinbutton", ROLE_SPINBUTTON); + testRole("aria_spinbutton_mixed", ROLE_SPINBUTTON); + testRole("aria_status", ROLE_STATUSBAR); + testRole("aria_status_mixed", ROLE_STATUSBAR); + testRole("aria_subscript", ROLE_SUBSCRIPT); + testRole("aria_subscript_mixed", ROLE_SUBSCRIPT); + testRole("aria_suggestion", ROLE_SUGGESTION); + testRole("aria_suggestion_mixed", ROLE_SUGGESTION); + testRole("aria_superscript", ROLE_SUPERSCRIPT); + testRole("aria_superscript_mixed", ROLE_SUPERSCRIPT); + testRole("aria_switch", ROLE_SWITCH); + testRole("aria_switch_mixed", ROLE_SWITCH); + testRole("aria_tab", ROLE_PAGETAB); + testRole("aria_tab_mixed", ROLE_PAGETAB); + testRole("aria_tablist", ROLE_PAGETABLIST); + testRole("aria_tablist_mixed", ROLE_PAGETABLIST); + testRole("aria_tabpanel", ROLE_PROPERTYPAGE); + testRole("aria_tabpanel_mixed", ROLE_PROPERTYPAGE); + testRole("aria_term", ROLE_TERM); + testRole("aria_term_mixed", ROLE_TERM); + testRole("aria_textbox", ROLE_ENTRY); + testRole("aria_textbox_mixed", ROLE_ENTRY); + testRole("aria_timer", ROLE_TEXT); // weak role + testRole("aria_timer_mixed", ROLE_TEXT); // weak role + testRole("aria_toolbar", ROLE_TOOLBAR); + testRole("aria_toolbar_mixed", ROLE_TOOLBAR); + testRole("aria_tooltip", ROLE_TOOLTIP); + testRole("aria_tooltip_mixed", ROLE_TOOLTIP); + testRole("aria_tree", ROLE_OUTLINE); + testRole("aria_tree_mixed", ROLE_OUTLINE); + testRole("aria_treegrid", ROLE_TREE_TABLE); + testRole("aria_treegrid_mixed", ROLE_TREE_TABLE); + testRole("aria_treeitem", ROLE_OUTLINEITEM); + testRole("aria_treeitem_mixed", ROLE_OUTLINEITEM); + + // Note: + // The phrase "weak foo" here means that there is no good foo-to-platform + // role mapping. Similarly "strong foo" means there is a good foo-to- + // platform role mapping. + + testRole("articlemain", ROLE_LANDMARK); + testRole("articlemain_mixed", ROLE_LANDMARK); + testRole("articleform", ROLE_FORM); + testRole("articleform_mixed", ROLE_FORM); + + // Test article exposed as article + testRole("testArticle", ROLE_ARTICLE); + testRole("testArticle_mixed", ROLE_ARTICLE); + + // weak roles that are forms of "live regions" + testRole("log_table", ROLE_TABLE); + testRole("log_table_mixed", ROLE_TABLE); + testRole("timer_div", ROLE_SECTION); + testRole("timer_div_mixed", ROLE_SECTION); + + // other roles that are forms of "live regions" + testRole("marquee_h1", ROLE_ANIMATION); + testRole("marquee_h1_mixed", ROLE_ANIMATION); + + // strong landmark + testRole("application", ROLE_APPLICATION); + testRole("application_mixed", ROLE_APPLICATION); + testRole("form", ROLE_FORM); + testRole("form_mixed", ROLE_FORM); + testRole("application_table", ROLE_APPLICATION); + testRole("application_table_mixed", ROLE_APPLICATION); + + // landmarks + let landmarks = ["banner", "complementary", "contentinfo", + "main", "navigation", "search"]; + for (const l in landmarks) { + testRole(landmarks[l], ROLE_LANDMARK); + testRole(landmarks[l] + "_mixed", ROLE_LANDMARK); + } + + for (const l in landmarks) { + let id = landmarks[l] + "_table"; + testRole(id, ROLE_LANDMARK); + testRole(id + "_mixed", ROLE_LANDMARK); + + let accessibleTable = getAccessible(id, [nsIAccessibleTable], null, + DONOTFAIL_IF_NO_INTERFACE); + ok(!!accessibleTable, "landmarked table should have nsIAccessibleTable"); + + accessibleTable = getAccessible(id+"_mixed", [nsIAccessibleTable], null, + DONOTFAIL_IF_NO_INTERFACE); + ok(!!accessibleTable, "Uppercase landmarked table should have nsIAccessibleTable"); + + if (accessibleTable) + is(accessibleTable.getCellAt(0, 0).firstChild.name, "hi", "no cell"); + } + + // //////////////////////////////////////////////////////////////////////// + // test gEmptyRoleMap + testRole("buttontable_row", ROLE_TEXT_CONTAINER); + testRole("buttontable_row_mixed", ROLE_TEXT_CONTAINER); + testRole("buttontable_cell", ROLE_TEXT_CONTAINER); + testRole("buttontable_cell_mixed", ROLE_TEXT_CONTAINER); + + // abstract roles + var abstract_roles = ["composite", "landmark", "structure", "widget", + "window", "input", "range", "select", "section", + "sectionhead"]; + for (const a in abstract_roles) { + testRole(abstract_roles[a], ROLE_SECTION); + testRole(abstract_roles[a]+ "_mixed", ROLE_SECTION); + } + + // //////////////////////////////////////////////////////////////////////// + // roles transformed by ARIA state attributes + testRole("togglebutton", ROLE_TOGGLE_BUTTON); + testRole("togglebutton_mixed", ROLE_TOGGLE_BUTTON); + testRole("implicit_gridcell", ROLE_GRID_CELL); + testRole("implicit_gridcell_mixed", ROLE_GRID_CELL); + + // //////////////////////////////////////////////////////////////////////// + // ignore unknown roles, take first known + testRole("unknown_roles", ROLE_PUSHBUTTON); + testRole("unknown_roles_mixed", ROLE_PUSHBUTTON); + + // //////////////////////////////////////////////////////////////////////// + // misc roles + testRole("note", ROLE_NOTE); + testRole("note_mixed", ROLE_NOTE); + testRole("scrollbar", ROLE_SCROLLBAR); + testRole("scrollbar_mixed", ROLE_SCROLLBAR); + testRole("dir", ROLE_LIST); + testRole("dir_mixed", ROLE_LIST); + + // //////////////////////////////////////////////////////////////////////// + // test document role map update + var testDoc = getAccessible(document, [nsIAccessibleDocument]); + testRole(testDoc, ROLE_DOCUMENT); + document.body.setAttribute("role", "application"); + testRole(testDoc, ROLE_APPLICATION); + document.body.setAttribute("role", "APPLICATION"); + testRole(testDoc, ROLE_APPLICATION); + document.body.setAttribute("role", "dialog"); + testRole(testDoc, ROLE_DIALOG); + document.body.setAttribute("role", "DIALOG"); + testRole(testDoc, ROLE_DIALOG); + // Other roles aren't valid on body elements. + document.body.setAttribute("role", "document"); + testRole(testDoc, ROLE_DOCUMENT); + document.body.setAttribute("role", "DOCUMENT"); + testRole(testDoc, ROLE_DOCUMENT); + document.body.setAttribute("role", "button"); + testRole(testDoc, ROLE_DOCUMENT); + document.body.setAttribute("role", "BUTTON"); + testRole(testDoc, ROLE_DOCUMENT); + document.body.setAttribute("role", "main"); + testRole(testDoc, ROLE_DOCUMENT); + document.body.setAttribute("role", "MAIN"); + testRole(testDoc, ROLE_DOCUMENT); + + // Test equation image + testRole("img_eq", ROLE_FLAT_EQUATION); + testRole("img_eq_mixed", ROLE_FLAT_EQUATION); + + // Test textual equation + testRole("txt_eq", ROLE_FLAT_EQUATION); + testRole("txt_eq_mixed", ROLE_FLAT_EQUATION); + + // Test initial ARIA roles on the body element. + testBodyRole("iframe_aria_application", ROLE_APPLICATION); + testBodyRole("iframe_aria_application_mixed", ROLE_APPLICATION); + testBodyRole("iframe_aria_dialog", ROLE_DIALOG); + testBodyRole("iframe_aria_dialog_mixed", ROLE_DIALOG); + // role="alert" is valid on the body of chrome documents. + let win = Services.ww.openWindow( + null, + "chrome://mochitests/content/a11y/accessible/tests/mochitest/role/chrome_body_role_alert.xhtml", + "_blank", + "chrome", + [] + ); + await new Promise(resolve => addA11yLoadEvent(resolve, win)); + testRole(win.document, ROLE_ALERT); + win.close(); + // Other roles aren't valid on body elements. + testBodyRole("iframe_aria_document", ROLE_DOCUMENT); + testBodyRole("iframe_aria_document_mixed", ROLE_DOCUMENT); + testBodyRole("iframe_aria_button", ROLE_DOCUMENT); + testBodyRole("iframe_aria_button_mixed", ROLE_DOCUMENT); + testBodyRole("iframe_aria_main", ROLE_DOCUMENT); + testBodyRole("iframe_aria_main_mixed", ROLE_DOCUMENT); + // role="alert" is not valid on the body of content documents. + testBodyRole("iframe_aria_alert", ROLE_DOCUMENT); + testBodyRole("iframe_aria_alert_mixed", ROLE_DOCUMENT); + + SimpleTest.finish(); + } + + SimpleTest.waitForExplicitFinish(); + addA11yLoadEvent(doTest); + </script> +</head> +<body> + + <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=428479">Mozilla Bug 428479</a> + <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=429666">Mozilla Bug 429666</a> + <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=481114">Mozilla Bug 481114</a> + <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=469688">Mozilla Bug 469688</a> + <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=469688">Mozilla Bug 520188</a> + <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=529289">Mozilla Bug 529289</a> + <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=529289">Mozilla Bug 607219</a> + <a target="_blank" + title="HTML buttons with aria-pressed not exposing IA2 TOGGLE_BUTTON role" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=725432"> + Bug 725432 + </a> + <a target="_blank" + title="Map ARIA role FORM" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=735645"> + Bug 735645 + </a> + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=1136563" + title="Support ARIA 1.1 switch role"> + Bug 1136563 + </a> + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=1121518" + title="Support ARIA 1.1 searchbox role"> + Bug 1121518 + </a> + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=1356049" + title="Map ARIA figure role"> + Bug 1356049 + </a> + <p id="display"></p> + <div id="content" style="display: none"></div> + <pre id="test"> + </pre> + + <span id="aria_alert" role="alert"></span> + <span id="aria_alert_mixed" role="aLERt"></span> + <span id="aria_alertdialog" role="alertdialog"></span> + <span id="aria_alertdialog_mixed" role="aLERTDIALOg"></span> + <span id="aria_application" role="application"></span> + <span id="aria_application_mixed" role="aPPLICATIOn"></span> + <span id="aria_article" role="article"></span> + <span id="aria_article_mixed" role="aRTICLe"></span> + <span id="aria_blockquote" role="blockquote"></span> + <span id="aria_blockquote_mixed" role="bLOCKQUOTe"></span> + <span id="aria_button" role="button"></span> + <span id="aria_button_mixed" role="bUTTOn"></span> + <span id="aria_caption" role="caption"></span> + <span id="aria_caption_mixed" role="cAPTIOn"></span> + <span id="aria_checkbox" role="checkbox"></span> + <span id="aria_checkbox_mixed" role="cHECKBOx"></span> + <span id="aria_code" role="code"></span> + <span id="aria_code_mixed" role="cODe"></span> + <span id="aria_columnheader" role="columnheader"></span> + <span id="aria_columnheader_mixed" role="cOLUMNHEADEr"></span> + <span id="aria_combobox" role="combobox"></span> + <span id="aria_combobox_mixed" role="cOMBOBOx"></span> + <span id="aria_comment" role="comment"></span> + <span id="aria_comment_mixed" role="cOMMENt"></span> + <span id="aria_deletion" role="deletion"></span> + <span id="aria_deletion_mixed" role="dELETIOn"></span> + <span id="aria_dialog" role="dialog"></span> + <span id="aria_dialog_mixed" role="dIALOg"></span> + <span id="aria_directory" role="directory"></span> + <span id="aria_directory_mixed" role="dIRECTORy"></span> + <span id="aria_document" role="document"></span> + <span id="aria_document_mixed" role="dOCUMENt"></span> + <span id="aria_form" role="form"></span> + <span id="aria_form_mixed" role="fORm"></span> + <span id="aria_form_with_label" role="form" aria-label="Label"></span> + <span id="aria_form_with_label_mixed" role="fORm" aria-label="Label"></span> + <span id="aria_feed" role="feed"></span> + <span id="aria_feed_mixed" role="fEEd"></span> + <span id="aria_figure" role="figure"></span> + <span id="aria_figure_mixed" role="fIGURe"></span> + <span id="aria_grid" role="grid"></span> + <span id="aria_grid_mixed" role="gRId"></span> + <span id="aria_gridcell" role="gridcell"></span> + <span id="aria_gridcell_mixed" role="gRIDCELl"></span> + <span id="aria_group" role="group"></span> + <span id="aria_group_mixed" role="gROUp"></span> + <span id="aria_heading" role="heading"></span> + <span id="aria_heading_mixed" role="hEADINg"></span> + <span id="aria_img" role="img"></span> + <span id="aria_img_mixed" role="iMg"></span> + <span id="aria_insertion" role="insertion"></span> + <span id="aria_insertion_mixed" role="iNSERTIOn"></span> + <span id="aria_link" role="link"></span> + <span id="aria_link_mixed" role="lINk"></span> + <span id="aria_list" role="list"></span> + <span id="aria_list_mixed" role="lISt"></span> + <span id="aria_listbox" role="listbox"></span> + <span id="aria_listbox_mixed" role="lISTBOx"></span> + <span id="aria_listitem" role="listitem"></span> + <span id="aria_listitem_mixed" role="lISTITEm"></span> + <span id="aria_log" role="log"></span> + <span id="aria_log_mixed" role="lOg"></span> + <span id="aria_mark" role="mark"></span> + <span id="aria_mark_mixed" role="mARk"></span> + <span id="aria_marquee" role="marquee"></span> + <span id="aria_marquee_mixed" role="mARQUEe"></span> + <span id="aria_math" role="math"></span> + <span id="aria_math_mixed" role="mATh"></span> + <span id="aria_menu" role="menu"></span> + <span id="aria_menu_mixed" role="mENu"></span> + <span id="aria_menubar" role="menubar"></span> + <span id="aria_menubar_mixed" role="mENUBAr"></span> + <span id="aria_menuitem" role="menuitem"></span> + <span id="aria_menuitem_mixed" role="mENUITEm"></span> + <span id="aria_menuitemcheckbox" role="menuitemcheckbox"></span> + <span id="aria_menuitemcheckbox_mixed" role="mENUITEMCHECKBOx"></span> + <span id="aria_menuitemradio" role="menuitemradio"></span> + <span id="aria_menuitemradio_mixed" role="mENUITEMRADIo"></span> + <span id="aria_meter" role="meter"></span> + <span id="aria_meter_mixed" role="meTer"></span> + <span id="aria_note" role="note"></span> + <span id="aria_note_mixed" role="nOTe"></span> + <span id="aria_paragraph" role="paragraph"></span> + <span id="aria_paragraph_mixed" role="pARAGRAPh"></span> + <span id="aria_presentation" role="presentation" tabindex="0"></span> + <span id="aria_presentation_mixed" role="pRESENTATIOn" tabindex="0"></span> + <span id="aria_progressbar" role="progressbar"></span> + <span id="aria_progressbar_mixed" role="pROGRESSBAr"></span> + <span id="aria_radio" role="radio"></span> + <span id="aria_radio_mixed" role="rADIo"></span> + <span id="aria_radiogroup" role="radiogroup"></span> + <span id="aria_radiogroup_mixed" role="rADIOGROUp"></span> + <span id="aria_region_no_name" role="region"></span> + <span id="aria_region_no_name_mixed" role="rEGIOn"></span> + <span id="aria_region_has_label" role="region" aria-label="label"></span> + <span id="aria_region_has_label_mixed" role="rEGIOn" aria-label="label"></span> + <span id="aria_region_has_labelledby" role="region" aria-labelledby="label"><span id="label" aria-label="label"></span> + <span id="aria_region_has_labelledby_mixed" role="rEGIOn" aria-labelledby="label"><span id="label" aria-label="label"></span> + <span id="aria_region_has_title" role="region" title="title"></span> + <span id="aria_region_has_title_mixed" role="rEGIOn" title="title"></span> + <span id="aria_region_empty_name" role="region" aria-label="" title="" aria-labelledby="empty"></span><span id="empty"></span> + <span id="aria_region_empty_name_mixed" role="rEGIOn" aria-label="" title="" aria-labelledby="empty"></span><span id="empty"></span> + <table id="aria_region_as_table_with_caption" role="region"><caption>hello</caption></table> + <table id="aria_region_as_table_with_caption_mixed" role="rEGIOn"><caption>hello</caption></table> + <table id="aria_region_as_table_with_miscaption" role="region"><caption role="option">hello</caption></table> + <table id="aria_region_as_table_with_miscaption_mixed" role="rEGIOn"><caption role="option">hello</caption></table> + <span id="aria_row" role="row"></span> + <span id="aria_row_mixed" role="rOw"></span> + <span id="aria_rowheader" role="rowheader"></span> + <span id="aria_rowheader_mixed" role="rOWHEADEr"></span> + <span id="aria_scrollbar" role="scrollbar"></span> + <span id="aria_scrollbar_mixed" role="sCROLLBAr"></span> + <span id="aria_searchbox" role="textbox"></span> + <span id="aria_searchbox_mixed" role="tEXTBOx"></span> + <span id="aria_separator" role="separator"></span> + <span id="aria_separator_mixed" role="sEPARATOr"></span> + <span id="aria_slider" role="slider"></span> + <span id="aria_slider_mixed" role="sLIDEr"></span> + <span id="aria_spinbutton" role="spinbutton"></span> + <span id="aria_spinbutton_mixed" role="sPINBUTTOn"></span> + <span id="aria_status" role="status"></span> + <span id="aria_status_mixed" role="sTATUs"></span> + <span id="aria_subscript" role="subscript"></span> + <span id="aria_subscript_mixed" role="sUBSCRIPt"></span> + <span id="aria_suggestion" role="suggestion"></span> + <span id="aria_suggestion_mixed" role="sUGGESTIOn"></span> + <span id="aria_superscript" role="superscript"></span> + <span id="aria_superscript_mixed" role="sUPERSCRIPt"></span> + <span id="aria_switch" role="switch"></span> + <span id="aria_switch_mixed" role="sWITCh"></span> + <span id="aria_tab" role="tab"></span> + <span id="aria_tab_mixed" role="tAb"></span> + <span id="aria_tablist" role="tablist"></span> + <span id="aria_tablist_mixed" role="tABLISt"></span> + <span id="aria_tabpanel" role="tabpanel"></span> + <span id="aria_tabpanel_mixed" role="tABPANEl"></span> + <span id="aria_term" role="term"></span> + <span id="aria_term_mixed" role="tERm"></span> + <span id="aria_textbox" role="textbox"></span> + <span id="aria_textbox_mixed" role="tEXTBOx"></span> + <span id="aria_timer" role="timer"></span> + <span id="aria_timer_mixed" role="tIMEr"></span> + <span id="aria_toolbar" role="toolbar"></span> + <span id="aria_toolbar_mixed" role="tOOLBAr"></span> + <span id="aria_tooltip" role="tooltip"></span> + <span id="aria_tooltip_mixed" role="tOOLTIp"></span> + <span id="aria_tree" role="tree"></span> + <span id="aria_tree_mixed" role="tREe"></span> + <span id="aria_treegrid" role="treegrid"></span> + <span id="aria_treegrid_mixed" role="tREEGRId"></span> + <span id="aria_treeitem" role="treeitem"></span> + <span id="aria_treeitem_mixed" role="tREEITEm"></span> + + <article id="articlemain" role="main">a main area</article> + <article id="articlemain_mixed" role="mAIn">a main area</article> + <article id="articleform" role="form">a form area</article> + <article id="articleform_mixed" role="fORm">a form area</article> + + <div id="testArticle" role="article" title="Test article"> + <p>This is a paragraph inside the article.</p> + </div> + + <div id="testArticle_mixed" role="aRTICLe" title="Test article"> + <p>This is a paragraph inside the article.</p> + </div> + + <!-- "live" roles --> + <table role="log" id="log_table"> + <tr><td>Table based log</td></tr> + </table> + <table role="LOG" id="log_table_mixed"> + <tr><td>Table based log</td></tr> + </table> + <h1 role="marquee" id="marquee_h1">marquee</h1> + <h1 role="MARQUEE" id="marquee_h1_mixed">marquee</h1> + <div role="timer" id="timer_div">timer</div> + <div role="TIMER" id="timer_div_mixed">timer</div> + + <!-- landmarks --> + <div role="application" id="application">application</div> + <div role="aPPLICATIOn" id="application_mixed">application</div> + <div role="form" id="form">form</div> + <div role="fORm" id="form_mixed">form</div> + + <!-- weak landmarks --> + <div role="banner" id="banner">banner</div> + <div role="bANNEr" id="banner_mixed">banner</div> + <div role="complementary" id="complementary">complementary</div> + <div role="cOMPLEMENTARy" id="complementary_mixed">complementary</div> + <div role="contentinfo" id="contentinfo">contentinfo</div> + <div role="cONTENTINFo" id="contentinfo_mixed">contentinfo</div> + <div role="main" id="main">main</div> + <div role="mAIN" id="main_mixed">main</div> + <div role="navigation" id="navigation">navigation</div> + <div role="nAVIGATIOn" id="navigation_mixed">navigation</div> + <div role="search" id="search">search</div> + <div role="sEARCh" id="search_mixed">search</div> + + <!-- landmarks are tables --> + <table role="application" id="application_table">application table + <tr><td>hi<td></tr></table> + <table role="aPPLICATIOn" id="application_table_mixed">application table + <tr><td>hi<td></tr></table> + <table role="banner" id="banner_table">banner table + <tr><td>hi<td></tr></table> + <table role="bANNEr" id="banner_table_mixed">banner table + <tr><td>hi<td></tr></table> + <table role="complementary" id="complementary_table">complementary table + <tr><td>hi<td></tr></table> + <table role="cOMPLEMENTARy" id="complementary_table_mixed">complementary table + <tr><td>hi<td></tr></table> + <table role="contentinfo" id="contentinfo_table">contentinfo table + <tr><td>hi<td></tr></table> + <table role="cONTENTINFo" id="contentinfo_table_mixed">contentinfo table + <tr><td>hi<td></tr></table> + <table role="main" id="main_table">main table + <tr><td>hi<td></tr></table> + <table role="mAIn" id="main_table_mixed">main table + <tr><td>hi<td></tr></table> + <table role="navigation" id="navigation_table">navigation table + <tr><td>hi<td></tr></table> + <table role="nAVIGATIOn" id="navigation_table_mixed">navigation table + <tr><td>hi<td></tr></table> + <table role="search" id="search_table">search table + <tr><td>hi<td></tr></table> + <table role="sEARCh" id="search_table_mixed">search table + <tr><td>hi<td></tr></table> + + <!-- test gEmptyRoleMap --> + <table role="button"> + <tr id="buttontable_row"> + <td id="buttontable_cell">cell</td> + </tr> + </table> + <table role="bUTTOn"> + <tr id="buttontable_row_mixed"> + <td id="buttontable_cell_mixed">cell</td> + </tr> + </table> + + <!-- user agents must not map abstract roles to platform API --> + <!-- test abstract base type roles --> + <div role="composite" id="composite">composite</div> + <div role="cOMPOSITe" id="composite_mixed">composite</div> + <div role="landmark" id="landmark">landmark</div> + <div role="lANDMARk" id="landmark_mixed">landmark</div> + <div role="roletype" id="roletype">roletype</div> + <div role="rOLETYPe" id="roletype_mixed">roletype</div> + <div role="structure" id="structure">structure</div> + <div role="sTRUCTURe" id="structure_mixed">structure</div> + <div role="widget" id="widget">widget</div> + <div role="wIDGEt" id="widget_mixed">widget</div> + <div role="window" id="window">window</div> + <div role="wINDOw" id="window_mixed">window</div> + <!-- test abstract input roles --> + <div role="input" id="input">input</div> + <div role="iNPUt" id="input_mixed">input</div> + <div role="range" id="range">range</div> + <div role="rANGe" id="range_mixed">range</div> + <div role="select" id="select">select</div> + <div role="sELECt" id="select_mixed">select</div> + <!-- test abstract structure roles --> + <div role="section" id="section">section</div> + <div role="sECTIOn" id="section_mixed">section</div> + <div role="sectionhead" id="sectionhead">sectionhead</div> + <div role="sECTIONHEAd" id="sectionhead_mixed">sectionhead</div> + + <!-- roles transformed by ARIA roles of ancestors --> + <table role="grid"> + <tr> + <td id="implicit_gridcell">foo</td> + </tr> + </table> + <table role="gRId"> + <tr> + <td id="implicit_gridcell_mixed">foo</td> + </tr> + </table> + + <!-- roles transformed by ARIA state attributes --> + <button aria-pressed="true" id="togglebutton"></button> + <button aria-pressed="tRUe" id="togglebutton_mixed"></button> + + <!-- take the first known mappable role --> + <div role="wiggly:worm abc123 button" id="unknown_roles">worm button</div> + <div role="wiggly:worm abc123 bUTTOn" id="unknown_roles_mixed">worm button</div> + + <!-- misc roles --> + <div role="note" id="note">note</div> + <div role="nOTe" id="note_mixed">note</div> + <div role="scrollbar" id="scrollbar">scrollbar</div> + <div role="sCROLLBAr" id="scrollbar_mixed">scrollbar</div> + + <div id="dir" role="directory"> + <div role="listitem">A</div> + <div role="listitem">B</div> + <div role="listitem">C</div> + </div> + + <div id="dir_mixed" role="dIRECTORy"> + <div role="listitem">A</div> + <div role="listitem">B</div> + <div role="listitem">C</div> + </div> + + <p>Image: + <img id="img_eq" role="math" src="foo" alt="x^2 + y^2 + z^2"> + </p> + + <p>Image: + <img id="img_eq_mixed" role="mATh" src="foo" alt="x^2 + y^2 + z^2"> + </p> + + <p>Text: + <span id="txt_eq" role="math" title="x^2 + y^2 + z^2">x<sup>2</sup> + + y<sup>2</sup> + z<sup>2</sup></span> + </p> + <p>Text: + <span id="txt_eq_mixed" role="mATh" title="x^2 + y^2 + z^2">x<sup>2</sup> + + y<sup>2</sup> + z<sup>2</sup></span> + </p> + + <iframe id="iframe_aria_application" + src="data:text/html,<body role='application'>"></iframe> + <iframe id="iframe_aria_application_mixed" + src="data:text/html,<body role='aPPLICATIOn'>"></iframe> + <iframe id="iframe_aria_dialog" + src="data:text/html,<body role='dialog'>"></iframe> + <iframe id="iframe_aria_dialog_mixed" + src="data:text/html,<body role='dIALOg'>"></iframe> + <iframe id="iframe_aria_document" + src="data:text/html,<body role='document'>"></iframe> + <iframe id="iframe_aria_document_mixed" + src="data:text/html,<body role='dOCUMENt'>"></iframe> + <iframe id="iframe_aria_button" + src="data:text/html,<body role='button'>"></iframe> + <iframe id="iframe_aria_button_mixed" + src="data:text/html,<body role='bUTTOn'>"></iframe> + <iframe id="iframe_aria_main" + src="data:text/html,<body role='main'>"></iframe> + <iframe id="iframe_aria_main_mixed" + src="data:text/html,<body role='mAIn'>"></iframe> + <iframe id="iframe_aria_alert" + src="data:text/html,<body role='alert'>"></iframe> + <iframe id="iframe_aria_alert_mixed" + src="data:text/html,<body role='aLERt'>"></iframe> + +</body> +</html> diff --git a/accessible/tests/mochitest/role/test_aria.xhtml b/accessible/tests/mochitest/role/test_aria.xhtml new file mode 100644 index 0000000000..9aea4ec222 --- /dev/null +++ b/accessible/tests/mochitest/role/test_aria.xhtml @@ -0,0 +1,65 @@ +<?xml version="1.0"?> +<?xml-stylesheet href="chrome://global/skin" type="text/css"?> +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" + type="text/css"?> + +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" + title="Accessibility Name Calculating Test."> + + <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> + + <script type="application/javascript" + src="../common.js"></script> + <script type="application/javascript" + src="../role.js" /> + + <script type="application/javascript"> + <![CDATA[ + function doTest() + { + ok(!isAccessible("presentation_label"), + "Presentation label shouldn't be accessible."); + ok(!isAccessible("presentation_descr"), + "Presentation description shouldn't be accessible."); + + // aria-pressed + testRole("pressed_button", ROLE_TOGGLE_BUTTON); + + SimpleTest.finish(); + } + + SimpleTest.waitForExplicitFinish(); + addA11yLoadEvent(doTest); + ]]> + </script> + + <hbox flex="1" style="overflow: auto;"> + + <body xmlns="http://www.w3.org/1999/xhtml"> + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=494345" + title="Do not create accessibles for XUL label or description having a role of 'presentation'"> + Mozilla Bug 494345 + </a> + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=1033283" + title="Expose pressed state on XUL menu toggle buttons"> + Mozilla Bug 1033283 + </a> + <p id="display"></p> + <div id="content" style="display: none"> + </div> + <pre id="test"> + </pre> + </body> + + <vbox flex="1"> + <label id="presentation_label" role="presentation" value="label"/> + <description id="presentation_descr" role="presentation" value="description"/> + <button id="pressed_button" aria-pressed="true" label="I am pressed" /> + </vbox> + + + </hbox> +</window> + diff --git a/accessible/tests/mochitest/role/test_dpub_aria.html b/accessible/tests/mochitest/role/test_dpub_aria.html new file mode 100644 index 0000000000..621c86a59b --- /dev/null +++ b/accessible/tests/mochitest/role/test_dpub_aria.html @@ -0,0 +1,114 @@ +<!DOCTYPE html> +<html> +<head> + <title>Test DPub ARIA roles</title> + + <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" /> + + <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> + + <script type="application/javascript" + src="../common.js"></script> + <script type="application/javascript" + src="../role.js"></script> + + <script type="application/javascript"> + + function doTest() { + // DPub ARIA role map. + testRole("doc-abstract", ROLE_SECTION); + testRole("doc-acknowledgments", ROLE_LANDMARK); + testRole("doc-afterword", ROLE_LANDMARK); + testRole("doc-appendix", ROLE_LANDMARK); + testRole("doc-backlink", ROLE_LINK); + testRole("doc-biblioentry", ROLE_LISTITEM); + testRole("doc-bibliography", ROLE_LANDMARK); + testRole("doc-biblioref", ROLE_LINK); + testRole("doc-chapter", ROLE_LANDMARK); + testRole("doc-colophon", ROLE_SECTION); + testRole("doc-conclusion", ROLE_LANDMARK); + testRole("doc-cover", ROLE_GRAPHIC); + testRole("doc-credit", ROLE_SECTION); + testRole("doc-credits", ROLE_LANDMARK); + testRole("doc-dedication", ROLE_SECTION); + testRole("doc-endnote", ROLE_LISTITEM); + testRole("doc-endnotes", ROLE_LANDMARK); + testRole("doc-epigraph", ROLE_SECTION); + testRole("doc-epilogue", ROLE_LANDMARK); + testRole("doc-errata", ROLE_LANDMARK); + testRole("doc-example", ROLE_SECTION); + testRole("doc-footnote", ROLE_FOOTNOTE); + testRole("doc-foreword", ROLE_LANDMARK); + testRole("doc-glossary", ROLE_LANDMARK); + testRole("doc-glossref", ROLE_LINK); + testRole("doc-index", ROLE_NAVIGATION); + testRole("doc-introduction", ROLE_LANDMARK); + testRole("doc-noteref", ROLE_LINK); + testRole("doc-notice", ROLE_NOTE); + testRole("doc-pagebreak", ROLE_SEPARATOR); + testRole("doc-pagelist", ROLE_NAVIGATION); + testRole("doc-part", ROLE_LANDMARK); + testRole("doc-preface", ROLE_LANDMARK); + testRole("doc-prologue", ROLE_LANDMARK); + testRole("doc-pullquote", ROLE_SECTION); + testRole("doc-qna", ROLE_SECTION); + testRole("doc-subtitle", ROLE_HEADING); + testRole("doc-tip", ROLE_NOTE); + testRole("doc-toc", ROLE_NAVIGATION); + SimpleTest.finish(); + } + + SimpleTest.waitForExplicitFinish(); + addA11yLoadEvent(doTest); + </script> +</head> +<body> + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=1343537" + title="implement ARIA DPUB extension"> + Bug 1343537 + </a> + <p id="display"></p> + <div id="content" style="display: none"></div> + <pre id="test"></pre> + <div id="doc-abstract" role="doc-abstract">abstract</div> + <div id="doc-acknowledgments" role="doc-acknowledgments">acknowledgments</div> + <div id="doc-afterword" role="doc-afterword">afterword</div> + <div id="doc-appendix" role="doc-appendix">appendix</div> + <div id="doc-backlink" role="doc-backlink">backlink</div> + <div id="doc-biblioentry" role="doc-biblioentry">biblioentry</div> + <div id="doc-bibliography" role="doc-bibliography">bibliography</div> + <div id="doc-biblioref" role="doc-biblioref">biblioref</div> + <div id="doc-chapter" role="doc-chapter">chapter</div> + <div id="doc-colophon" role="doc-colophon">colophon</div> + <div id="doc-conclusion" role="doc-conclusion">conclusion</div> + <div id="doc-cover" role="doc-cover">cover</div> + <div id="doc-credit" role="doc-credit">credit</div> + <div id="doc-credits" role="doc-credits">credits</div> + <div id="doc-dedication" role="doc-dedication">dedication</div> + <div id="doc-endnote" role="doc-endnote">endnote</div> + <div id="doc-endnotes" role="doc-endnotes">endnotes</div> + <div id="doc-epigraph" role="doc-epigraph">epigraph</div> + <div id="doc-epilogue" role="doc-epilogue">epilogue</div> + <div id="doc-errata" role="doc-errata">errata</div> + <div id="doc-example" role="doc-example">example</div> + <div id="doc-footnote" role="doc-footnote">footnote</div> + <div id="doc-foreword" role="doc-foreword">foreword</div> + <div id="doc-glossary" role="doc-glossary">glossary</div> + <div id="doc-glossref" role="doc-glossref">glossref</div> + <div id="doc-index" role="doc-index">index</div> + <div id="doc-introduction" role="doc-introduction">introduction</div> + <div id="doc-noteref" role="doc-noteref">noteref</div> + <div id="doc-notice" role="doc-notice">notice</div> + <div id="doc-pagebreak" role="doc-pagebreak">pagebreak</div> + <div id="doc-pagelist" role="doc-pagelist">pagelist</div> + <div id="doc-part" role="doc-part">part</div> + <div id="doc-preface" role="doc-preface">preface</div> + <div id="doc-prologue" role="doc-prologue">prologue</div> + <div id="doc-pullquote" role="doc-pullquote">pullquote</div> + <div id="doc-qna" role="doc-qna">qna</div> + <div id="doc-subtitle" role="doc-subtitle">subtitle</div> + <div id="doc-tip" role="doc-tip">tip</div> + <div id="doc-toc" role="doc-toc">toc</div> +</body> +</html> diff --git a/accessible/tests/mochitest/role/test_general.html b/accessible/tests/mochitest/role/test_general.html new file mode 100644 index 0000000000..38dde3325a --- /dev/null +++ b/accessible/tests/mochitest/role/test_general.html @@ -0,0 +1,201 @@ +<!DOCTYPE html> +<html> +<head> + <title>test nsHyperTextAccessible accesible objects creation and their roles</title> + <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" /> + + <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> + + <script type="application/javascript" + src="../common.js"></script> + <script type="application/javascript" + src="../role.js"></script> + <script type="application/javascript" + src="../attributes.js"></script> + + <script type="application/javascript"> + function doTests() { + // landmark tests section + testRole("frm", ROLE_FORM); + + // nsHyperTextAcc tests section + // Test html:form. + testRole("nav", ROLE_LANDMARK); + testRole("header", ROLE_LANDMARK); + testRole("footer", ROLE_LANDMARK); + testRole("article", ROLE_ARTICLE); + testRole("aside", ROLE_LANDMARK); + testRole("section", ROLE_SECTION); + + // Bug 996821 + // Check that landmark elements get accessibles with styled overflow. + testRole("section_overflow", ROLE_SECTION); + testRole("nav_overflow", ROLE_LANDMARK); + testRole("header_overflow", ROLE_SECTION); + testRole("aside_overflow", ROLE_LANDMARK); + testRole("footer_overflow", ROLE_SECTION); + testRole("article_overflow", ROLE_ARTICLE); + + // test html:div + testRole("sec", ROLE_SECTION); + + // Test html:blockquote + testRole("quote", ROLE_BLOCKQUOTE); + + // Test html:h, all levels + testRole("head1", ROLE_HEADING); + testRole("head2", ROLE_HEADING); + testRole("head3", ROLE_HEADING); + testRole("head4", ROLE_HEADING); + testRole("head5", ROLE_HEADING); + testRole("head6", ROLE_HEADING); + + // Test that an html:input @type="file" is exposed as ROLE_PUSHBUTTON. + testRole("data", ROLE_PUSHBUTTON); + + // Test that input type="checkbox" and type="radio" are + // exposed as such regardless of appearance style. + testRole("checkbox_regular", ROLE_CHECKBUTTON); + testRole("checkbox_appearance_none", ROLE_CHECKBUTTON); + testRole("radio_regular", ROLE_RADIOBUTTON); + testRole("radio_appearance_none", ROLE_RADIOBUTTON); + + // Test regular paragraph by comparison to make sure exposure does not + // get broken. + testRole("p", ROLE_PARAGRAPH); + + // Test dl, dt, dd + testRole("definitionlist", ROLE_DEFINITION_LIST); + testRole("definitionterm", ROLE_TERM); + testRole("definitiondescription", ROLE_DEFINITION); + + // Has click, mousedown or mouseup listeners. + testRole("span1", ROLE_TEXT); + testRole("span2", ROLE_TEXT); + testRole("span3", ROLE_TEXT); + + // Test role of listbox inside combobox + testRole("listbox1", ROLE_COMBOBOX_LIST); + testRole("listbox2", ROLE_COMBOBOX_LIST); + + // Test role of menu and li items in menu + testRole("menu", ROLE_LIST); + testRole("menuItem", ROLE_LISTITEM); + + SimpleTest.finish(); + } + + SimpleTest.waitForExplicitFinish(); + addA11yLoadEvent(doTests); + </script> +</head> +<body> + + <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=472326" + title="html:input of type "file" no longer rendered to screen readers"> + Mozilla Bug 472326 + </a><br> + <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=474261" + title="Test remaining implementations in nsHyperTextAccessible::GetRole"> + bug 474261 + </a><br> + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=423409" + title="Expose click action if mouseup and mousedown are registered"> + Mozilla Bug 423409 + </a> + <a target="_blank" + title="Provide mappings for html5 <nav> <header> <footer> <article>" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=593368"> + Bug 593368 + </a><br/> + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=613502" + title="Map <article> like we do aria role article"> + Bug 613502 + </a> + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=610650" + title="Change implementation of HTML5 landmark elements to conform"> + Bug 610650 + </a> + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=614310" + title="Map section to pane (like role=region)"> + Mozilla Bug 614310 + </a> + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=734982" + title="Map ARIA role FORM"> + Bug 734982 + </a> + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=1044431" + title="Listbox owned by combobox has the wrong role"> + Mozilla Bug 1044431 + </a> + + <p id="display"></p> + <div id="content" style="display: none"></div> + <pre id="test"> + </pre> + + <form id="frm" action="submit.php" method="post"> + <label for="data">File</label>: + <input type="file" id="data" name="data" size="50"/> + <input type="checkbox" id="checkbox_regular" value="Check me"/> + <input type="checkbox" style="-moz-appearance: none;" id="checkbox_appearance_none" value="Check me"/> + <input type="radio" id="radio_regular" value="Check me"/> + <input type="radio" style="-moz-appearance: none;" id="radio_appearance_none" value="Check me"/> + </form> + + <nav id="nav">a nav</nav> + <header id="header">a header</header> + <footer id="footer">a footer</footer> + <article id="article">an article</article> + <aside id="aside">by the way I am an aside</aside> + <section id="section">a section</section> + + <section style="overflow: hidden;" id="section_overflow"> + <nav style="overflow: hidden;" + id="nav_overflow">overflow nav</nav> + <header style="overflow: hidden;" + id="header_overflow">overflow header</header> + <aside style="overflow: hidden;" + id="aside_overflow">overflow aside</aside> + <footer style="overflow: hidden;" + id="footer_overflow">overflow footer</footer> + </section> + <article style="overflow: hidden;" + id="article_overflow">overflow article</article> + + <p id="p">A paragraph for comparison.</p> + <div id="sec">A normal div</div> + <blockquote id="quote">A citation</blockquote> + <h1 id="head1">A heading level 1</h1> + <h2 id="head2">A heading level 2</h2> + <h3 id="head3">A heading level 3</h3> + <h4 id="head4">A heading level 4</h4> + <h5 id="head5">A heading level 5</h5> + <h6 id="head6">A heading level 6</h6> + + <dl id="definitionlist"> + <dt id="definitionterm">gecko</dt> + <dd id="definitiondescription">geckos have sticky toes</dd> + </dl> + + <span id="span1" onclick="">clickable span</span> + <span id="span2" onmousedown="">clickable span</span> + <span id="span3" onmouseup="">clickable span</span> + + <div id="combobox1" role="combobox"> + <div id="listbox1" role="listbox"></div> + </div> + <div id="combobox2" role="combobox" aria-owns="listbox2"></div> + <div id="listbox2" role="listbox"></div> + + <menu id="menu"> + <li id="menuItem">menu item!</li> + </menu> +</body> +</html> diff --git a/accessible/tests/mochitest/role/test_general.xhtml b/accessible/tests/mochitest/role/test_general.xhtml new file mode 100644 index 0000000000..95de7775ea --- /dev/null +++ b/accessible/tests/mochitest/role/test_general.xhtml @@ -0,0 +1,59 @@ +<?xml version="1.0"?> +<?xml-stylesheet href="chrome://global/skin" type="text/css"?> +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" + type="text/css"?> + +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" + title="Accessibility Role XUL Test."> + + <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> + + <script type="application/javascript" + src="../common.js"></script> + <script type="application/javascript" + src="../role.js"></script> + + <script type="application/javascript"> + <![CDATA[ + function doTest() + { + ok(!isAccessible("image"), + "image without tooltiptext shouldn't be accessible."); + testRole("image-tooltiptext", ROLE_GRAPHIC); + + ok(!isAccessible("statusbarpanel"), + "statusbarpanel shouldn't be accessible."); + testRole("statusbar", ROLE_STATUSBAR); + + SimpleTest.finish(); + } + + SimpleTest.waitForExplicitFinish(); + addA11yLoadEvent(doTest); + ]]> + </script> + + <hbox flex="1" style="overflow: auto;"> + + <body xmlns="http://www.w3.org/1999/xhtml"> + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=900097" + title="statusbarpanel shouldn't be a button accessible"> + Mozilla Bug 900097 + </a> + <p id="display"></p> + <div id="content" style="display: none"> + </div> + <pre id="test"> + </pre> + </body> + + <image id="image" src="../moz.png"/> + <image id="image-tooltiptext" src="../moz.png" tooltiptext="hello"/> + + <statusbarpanel id="statusbarpanel"></statusbarpanel> + <statusbar id="statusbar"></statusbar> + + </hbox> +</window> + diff --git a/accessible/tests/mochitest/role/test_graphics_aria.html b/accessible/tests/mochitest/role/test_graphics_aria.html new file mode 100644 index 0000000000..8ddfe9224d --- /dev/null +++ b/accessible/tests/mochitest/role/test_graphics_aria.html @@ -0,0 +1,42 @@ +<!DOCTYPE html> +<html> +<head> + <title>Test Graphics ARIA roles</title> + + <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" /> + + <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> + + <script type="application/javascript" + src="../common.js"></script> + <script type="application/javascript" + src="../role.js"></script> + + <script type="application/javascript"> + + function doTest() { + // Graphics ARIA role map. + testRole("graphics-document", ROLE_NON_NATIVE_DOCUMENT); + testRole("graphics-object", ROLE_GROUPING); + testRole("graphics-symbol", ROLE_GRAPHIC); + SimpleTest.finish(); + } + + SimpleTest.waitForExplicitFinish(); + addA11yLoadEvent(doTest); + </script> +</head> +<body> + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=1432513" + title="implement ARIA Graphics roles"> + Bug 1432513 + </a> + <p id="display"></p> + <div id="content" style="display: none"></div> + <pre id="test"></pre> + <div id="graphics-document" role="graphics-document">document</div> + <div id="graphics-object" role="graphics-object">object</div> + <div id="graphics-symbol" role="graphics-symbol">symbol</div> +</body> +</html> diff --git a/accessible/tests/mochitest/role/test_svg.html b/accessible/tests/mochitest/role/test_svg.html new file mode 100644 index 0000000000..716dae7ee2 --- /dev/null +++ b/accessible/tests/mochitest/role/test_svg.html @@ -0,0 +1,93 @@ +<!DOCTYPE html> +<html> +<head> + <title>SVG elements accessible roles</title> + <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" /> + + <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> + + <script type="application/javascript" + src="../common.js"></script> + <script type="application/javascript" + src="../role.js"></script> + <script type="application/javascript" + src="../attributes.js"></script> + + <script type="application/javascript"> + function doTests() { + testRole("svg", ROLE_DIAGRAM); + testRole("g", ROLE_GROUPING); + testRole("rect", ROLE_GRAPHIC); + testRole("circle", ROLE_GRAPHIC); + testRole("ellipse", ROLE_GRAPHIC); + testRole("line", ROLE_GRAPHIC); + testRole("polygon", ROLE_GRAPHIC); + testRole("polyline", ROLE_GRAPHIC); + testRole("path", ROLE_GRAPHIC); + testRole("image", ROLE_GRAPHIC); + testRole("image2", ROLE_GRAPHIC); + testRole("a", ROLE_LINK); + + SimpleTest.finish(); + } + + SimpleTest.waitForExplicitFinish(); + addA11yLoadEvent(doTests); + </script> +</head> +<body> + + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=822983" + title="Map SVG graphic elements to accessibility API"> + Bug 822983 + </a> + + <p id="display"></p> + <div id="content" style="display: none"></div> + <pre id="test"> + </pre> + + <svg xmlns="http://www.w3.org/2000/svg" version="1.1" id="svg" + xmlns:xlink="http://www.w3.org/1999/xlink"> + <g id="g"> + <title>g</title> + </g> + <rect width="300" height="100" id="rect" + style="fill:rgb(0,0,255);stroke-width:1;stroke:rgb(0,0,0)"> + <title>rect</title> + </rect> + <circle cx="100" cy="50" r="40" stroke="black" id="circle" + stroke-width="2" fill="red"> + <title>circle</title> + </circle> + <ellipse cx="300" cy="80" rx="100" ry="50" id="ellipse" + style="fill:yellow;stroke:purple;stroke-width:2"> + <title>ellipse</title> + </ellipse> + <line x1="0" y1="0" x2="200" y2="200" id="line" + style="stroke:rgb(255,0,0);stroke-width:2"> + <title>line</title> + </line> + <polygon points="200,10 250,190 160,210" id="polygon" + style="fill:lime;stroke:purple;stroke-width:1"> + <title>polygon</title> + </polygon> + <polyline points="20,20 40,25 60,40 80,120 120,140 200,180" id="polyline" + style="fill:none;stroke:black;stroke-width:3" > + <title>polyline</title> + </polyline> + <path d="M150 0 L75 200 L225 200 Z" id="path"> + <title>path</title> + </path> + <image x1="25" y1="80" width="50" height="20" id="image" + xlink:href="../moz.png"> + <title>image</title> + </image> + <image x1="25" y1="110" width="50" height="20" id="image2" + xlink:href="../moz.png" aria-label="hello"/> + <a href="#" id="a"><text>a</text></a> + </svg> + +</body> +</html> |