gecko/browser/devtools/styleinspector/test/browser_computedview_style-editor-link.js
Patrick Brosset 50959813c8 Bug 988313 - Rename devtools/styleinspector tests for consistency reasons. r=miker
--HG--
rename : browser/devtools/styleinspector/test/browser_styleinspector_bug_672746_default_styles.js => browser/devtools/styleinspector/test/browser_computedview_browser-styles.js
rename : browser/devtools/styleinspector/test/browser_bug589375_keybindings.js => browser/devtools/styleinspector/test/browser_computedview_keybindings_01.js
rename : browser/devtools/styleinspector/test/browser_computedview_bug835808_keyboard_nav.js => browser/devtools/styleinspector/test/browser_computedview_keybindings_02.js
rename : browser/devtools/styleinspector/test/browser_bug913014_matched_expand.js => browser/devtools/styleinspector/test/browser_computedview_matched-selectors-toggle.js
rename : browser/devtools/styleinspector/test/browser_bug683672.js => browser/devtools/styleinspector/test/browser_computedview_matched-selectors_01.js
rename : browser/devtools/styleinspector/test/browser_bug_692400_element_style.js => browser/devtools/styleinspector/test/browser_computedview_matched-selectors_02.js
rename : browser/devtools/styleinspector/test/browser_bug722196_property_view_media_queries.js => browser/devtools/styleinspector/test/browser_computedview_media-queries.js
rename : browser/devtools/styleinspector/test/browser_styleinspector_bug_689759_no_results_placeholder.js => browser/devtools/styleinspector/test/browser_computedview_no-results-placeholder.js
rename : browser/devtools/styleinspector/test/browser_computedview_original_source_link.js => browser/devtools/styleinspector/test/browser_computedview_original-source-link.js
rename : browser/devtools/styleinspector/test/browser_styleinspector_bug_672744_search_filter.js => browser/devtools/styleinspector/test/browser_computedview_search-filter.js
rename : browser/devtools/styleinspector/test/browser_computedview_copy.js => browser/devtools/styleinspector/test/browser_computedview_select-and-copy-styles.js
rename : browser/devtools/styleinspector/test/browser_computedview_734259_style_editor_link.js => browser/devtools/styleinspector/test/browser_computedview_style-editor-link.js
rename : browser/devtools/styleinspector/test/browser_ruleview_add_property_01.js => browser/devtools/styleinspector/test/browser_ruleview_add-property-and-reselect.js
rename : browser/devtools/styleinspector/test/browser_ruleview_editor_changedvalues_01.js => browser/devtools/styleinspector/test/browser_ruleview_add-property-cancel_01.js
rename : browser/devtools/styleinspector/test/browser_ruleview_editor_changedvalues_03.js => browser/devtools/styleinspector/test/browser_ruleview_add-property-cancel_02.js
rename : browser/devtools/styleinspector/test/browser_ruleview_cancel.js => browser/devtools/styleinspector/test/browser_ruleview_add-property-cancel_03.js
rename : browser/devtools/styleinspector/test/browser_ruleview_editor_changedvalues_02.js => browser/devtools/styleinspector/test/browser_ruleview_add-property_01.js
rename : browser/devtools/styleinspector/test/browser_ruleview_add_property_02.js => browser/devtools/styleinspector/test/browser_ruleview_add-property_02.js
rename : browser/devtools/styleinspector/test/browser_bug940500_rule_view_pick_gradient_color.js => browser/devtools/styleinspector/test/browser_ruleview_colorpicker-edit-gradient.js
rename : browser/devtools/styleinspector/test/browser_bug893965_css_property_completion_existing_property.js => browser/devtools/styleinspector/test/browser_ruleview_completion-existing-property_01.js
rename : browser/devtools/styleinspector/test/browser_bug894376_css_value_completion_existing_property_value_pair.js => browser/devtools/styleinspector/test/browser_ruleview_completion-existing-property_02.js
rename : browser/devtools/styleinspector/test/browser_bug893965_css_property_completion_new_property.js => browser/devtools/styleinspector/test/browser_ruleview_completion-new-property_01.js
rename : browser/devtools/styleinspector/test/browser_bug894376_css_value_completion_new_property_value_pair.js => browser/devtools/styleinspector/test/browser_ruleview_completion-new-property_02.js
rename : browser/devtools/styleinspector/test/browser_ruleview_bug_902966_revert_value_on_ESC.js => browser/devtools/styleinspector/test/browser_ruleview_edit-property-commit.js
rename : browser/devtools/styleinspector/test/browser_bug722691_rule_view_increment.js => browser/devtools/styleinspector/test/browser_ruleview_edit-property-increments.js
rename : browser/devtools/styleinspector/test/browser_ruleview_manipulation.js => browser/devtools/styleinspector/test/browser_ruleview_edit-property-order.js
rename : browser/devtools/styleinspector/test/browser_ruleview_editor_changedvalues_04.js => browser/devtools/styleinspector/test/browser_ruleview_edit-property_01.js
rename : browser/devtools/styleinspector/test/browser_ruleview_edit.js => browser/devtools/styleinspector/test/browser_ruleview_edit-property_02.js
rename : browser/devtools/styleinspector/test/browser_ruleview_focus.js => browser/devtools/styleinspector/test/browser_ruleview_keybindings.js
rename : browser/devtools/styleinspector/test/browser_bug970532_mathml_element.js => browser/devtools/styleinspector/test/browser_ruleview_mathml-element.js
rename : browser/devtools/styleinspector/test/browser_bug722196_rule_view_media_queries.js => browser/devtools/styleinspector/test/browser_ruleview_media-queries.js
rename : browser/devtools/styleinspector/test/browser_ruleview_multiple_properties_02.js => browser/devtools/styleinspector/test/browser_ruleview_multiple-properties-duplicates.js
rename : browser/devtools/styleinspector/test/browser_ruleview_multiple_properties_03.js => browser/devtools/styleinspector/test/browser_ruleview_multiple-properties-priority.js
rename : browser/devtools/styleinspector/test/browser_ruleview_multiple_properties_04.js => browser/devtools/styleinspector/test/browser_ruleview_multiple-properties-unfinished_01.js
rename : browser/devtools/styleinspector/test/browser_ruleview_multiple_properties_05.js => browser/devtools/styleinspector/test/browser_ruleview_multiple-properties-unfinished_02.js
rename : browser/devtools/styleinspector/test/browser_ruleview_original_source_link.js => browser/devtools/styleinspector/test/browser_ruleview_original-source-link.js
rename : browser/devtools/styleinspector/test/browser_ruleview_pseudoelement.js => browser/devtools/styleinspector/test/browser_ruleview_pseudo-element.js
rename : browser/devtools/styleinspector/test/browser_ruleview_copy.js => browser/devtools/styleinspector/test/browser_ruleview_select-and-copy-styles.js
rename : browser/devtools/styleinspector/test/browser_ruleview_734259_style_editor_link.js => browser/devtools/styleinspector/test/browser_ruleview_style-editor-link.js
rename : browser/devtools/styleinspector/test/browser_styleinspector_bug_677930_urls_clickable.js => browser/devtools/styleinspector/test/browser_ruleview_urls-clickable.js
rename : browser/devtools/styleinspector/test/browser_bug942297_user_property_reset.js => browser/devtools/styleinspector/test/browser_ruleview_user-property-reset.js
rename : browser/devtools/styleinspector/test/browser_bug705707_is_content_stylesheet.js => browser/devtools/styleinspector/test/browser_styleinspector_csslogic-content-stylesheets.js
rename : browser/devtools/styleinspector/test/browser_csslogic_inherited.js => browser/devtools/styleinspector/test/browser_styleinspector_csslogic-inherited-properties.js
rename : browser/devtools/styleinspector/test/browser_bug_592743_specificity.js => browser/devtools/styleinspector/test/browser_styleinspector_csslogic-specificity.js
rename : browser/devtools/styleinspector/test/browser_ruleview_editor.js => browser/devtools/styleinspector/test/browser_styleinspector_inplace-editor.js
rename : browser/devtools/styleinspector/test/browser_styleinspector_outputparser.js => browser/devtools/styleinspector/test/browser_styleinspector_output-parser.js
rename : browser/devtools/styleinspector/test/browser_bug765105_background_image_tooltip.js => browser/devtools/styleinspector/test/browser_styleinspector_tooltip-background-image.js
rename : browser/devtools/styleinspector/test/browser_bug946331_close_tooltip_on_new_selection.js => browser/devtools/styleinspector/test/browser_styleinspector_tooltip-closes-on-new-selection.js
rename : browser/devtools/styleinspector/test/browser_bug702577_fontfamily_tooltip_longhand.js => browser/devtools/styleinspector/test/browser_styleinspector_tooltip-longhand-fontfamily.js
rename : browser/devtools/styleinspector/test/browser_bug702577_fontfamily_tooltip_shorthand.js => browser/devtools/styleinspector/test/browser_styleinspector_tooltip-shorthand-fontfamily.js
rename : browser/devtools/styleinspector/test/browser_bug726427_csstransform_tooltip.js => browser/devtools/styleinspector/test/browser_styleinspector_tooltip-transform.js
rename : browser/devtools/styleinspector/test/browser_bug705707_is_content_stylesheet.html => browser/devtools/styleinspector/test/doc_content_stylesheet.html
rename : browser/devtools/styleinspector/test/browser_bug705707_is_content_stylesheet.xul => browser/devtools/styleinspector/test/doc_content_stylesheet.xul
rename : browser/devtools/styleinspector/test/browser_bug705707_is_content_stylesheet_imported.css => browser/devtools/styleinspector/test/doc_content_stylesheet_imported.css
rename : browser/devtools/styleinspector/test/browser_bug705707_is_content_stylesheet_imported2.css => browser/devtools/styleinspector/test/doc_content_stylesheet_imported2.css
rename : browser/devtools/styleinspector/test/browser_bug705707_is_content_stylesheet_linked.css => browser/devtools/styleinspector/test/doc_content_stylesheet_linked.css
rename : browser/devtools/styleinspector/test/browser_bug705707_is_content_stylesheet_script.css => browser/devtools/styleinspector/test/doc_content_stylesheet_script.css
rename : browser/devtools/styleinspector/test/browser_bug705707_is_content_stylesheet_xul.css => browser/devtools/styleinspector/test/doc_content_stylesheet_xul.css
rename : browser/devtools/styleinspector/test/browser_bug683672.html => browser/devtools/styleinspector/test/doc_matched_selectors.html
rename : browser/devtools/styleinspector/test/browser_bug722196_identify_media_queries.html => browser/devtools/styleinspector/test/doc_media_queries.html
rename : browser/devtools/styleinspector/test/browser_ruleview_pseudoelement.html => browser/devtools/styleinspector/test/doc_pseudoelement.html
rename : browser/devtools/styleinspector/test/sourcemaps.css => browser/devtools/styleinspector/test/doc_sourcemaps.css
rename : browser/devtools/styleinspector/test/sourcemaps.css.map => browser/devtools/styleinspector/test/doc_sourcemaps.css.map
rename : browser/devtools/styleinspector/test/sourcemaps.html => browser/devtools/styleinspector/test/doc_sourcemaps.html
rename : browser/devtools/styleinspector/test/sourcemaps.scss => browser/devtools/styleinspector/test/doc_sourcemaps.scss
rename : browser/devtools/styleinspector/test/browser_ruleview_734259_style_editor_link.css => browser/devtools/styleinspector/test/doc_style_editor_link.css
rename : browser/devtools/styleinspector/test/test-image.png => browser/devtools/styleinspector/test/doc_test_image.png
rename : browser/devtools/styleinspector/test/browser_styleinspector_bug_677930_urls_clickable/browser_styleinspector_bug_677930_urls_clickable.css => browser/devtools/styleinspector/test/doc_urls_clickable.css
rename : browser/devtools/styleinspector/test/browser_styleinspector_bug_677930_urls_clickable.html => browser/devtools/styleinspector/test/doc_urls_clickable.html
2014-04-08 12:19:24 +02:00

115 lines
3.8 KiB
JavaScript

/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Test the links from the computed view to the style editor
const STYLESHEET_URL = "data:text/css,"+encodeURIComponent(
[".highlight {",
"color: blue",
"}"].join("\n"));
const DOCUMENT_URL = "data:text/html,"+encodeURIComponent(
['<html>' +
'<head>' +
'<title>Computed view style editor link test</title>',
'<style type="text/css"> ',
'html { color: #000000; } ',
'span { font-variant: small-caps; color: #000000; } ',
'.nomatches {color: #ff0000;}</style> <div id="first" style="margin: 10em; ',
'font-size: 14pt; font-family: helvetica, sans-serif; color: #AAA">',
'</style>',
'<link rel="stylesheet" type="text/css" href="'+STYLESHEET_URL+'">',
'</head>',
'<body>',
'<h1>Some header text</h1>',
'<p id="salutation" style="font-size: 12pt">hi.</p>',
'<p id="body" style="font-size: 12pt">I am a test-case. This text exists ',
'solely to provide some things to ',
'<span style="color: yellow" class="highlight">',
'highlight</span> and <span style="font-weight: bold">count</span> ',
'style list-items in the box at right. If you are reading this, ',
'you should go do something else instead. Maybe read a book. Or better ',
'yet, write some test-cases for another bit of code. ',
'<span style="font-style: italic">some text</span></p>',
'<p id="closing">more text</p>',
'<p>even more text</p>',
'</div>',
'</body>',
'</html>'].join("\n"));
let test = asyncTest(function*() {
yield addTab(DOCUMENT_URL);
info("Opening the computed-view");
let {toolbox, inspector, view} = yield openComputedView();
info("Selecting the test node");
yield selectNode("span", inspector);
yield testInlineStyle(view, inspector);
yield testInlineStyleSheet(view, toolbox);
yield testExternalStyleSheet(view, toolbox);
});
function* testInlineStyle(view, inspector) {
info("Testing inline style");
yield expandComputedViewPropertyByIndex(view, inspector, 0);
let onWindow = waitForWindow();
info("Clicking on the first rule-link in the computed-view");
let link = getComputedViewLinkByIndex(view, 0);
link.click();
let win = yield onWindow;
let windowType = win.document.documentElement.getAttribute("windowtype");
is(windowType, "navigator:view-source", "View source window is open");
info("Closing window");
win.close();
}
function* testInlineStyleSheet(view, toolbox) {
info("Testing inline stylesheet");
info("Listening for toolbox switch to the styleeditor");
let onSwitch = waitForStyleEditor(toolbox);
info("Clicking an inline stylesheet");
let link = getComputedViewLinkByIndex(view, 2);
link.click();
let editor = yield onSwitch;
ok(true, "Switched to the style-editor panel in the toolbox");
validateStyleEditorSheet(editor, 0);
}
function* testExternalStyleSheet(view, toolbox) {
info("Testing external stylesheet");
info("Waiting for the stylesheet editor to be selected");
let panel = toolbox.getCurrentPanel();
let onSelected = panel.UI.once("editor-selected");
info("Switching back to the inspector panel in the toolbox");
yield toolbox.selectTool("inspector");
info("Clicking on an external stylesheet link");
let link = getComputedViewLinkByIndex(view, 1);
link.click();
let editor = yield onSelected;
is(toolbox.currentToolId, "styleeditor", "The style editor is selected again");
validateStyleEditorSheet(editor, 1);
}
function validateStyleEditorSheet(editor, expectedSheetIndex) {
info("Validating style editor stylesheet");
let sheet = content.document.styleSheets[expectedSheetIndex];
is(editor.styleSheet.href, sheet.href, "loaded stylesheet matches document stylesheet");
}