gecko/browser/devtools/styleinspector/test/browser_styleinspector_tooltip-background-image.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

122 lines
8.5 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 that background-image URLs have image preview tooltips in the rule-view
// and computed-view
const PAGE_CONTENT = [
'<style type="text/css">',
' body {',
' padding: 1em;',
' background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAGXRFWHR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DG+HXfAcQcc49v/BBgAcFAO4DmB2GQAAAAASUVORK5CYII=);',
' background-repeat: repeat-y;',
' background-position: right top;',
' }',
' .test-element {',
' font-family: verdana;',
' color: #333;',
' background: url(chrome://global/skin/icons/warning-64.png) no-repeat left center;',
' padding-left: 70px;',
' }',
'</style>',
'<div class="test-element">test element</div>'
].join("\n");
let test = asyncTest(function*() {
yield addTab("data:text/html,rule view tooltip test");
content.document.body.innerHTML = PAGE_CONTENT;
let {toolbox, inspector, view} = yield openRuleView();
info("Testing the background-image property on the body rule");
yield testBodyRuleView(view);
info("Selecting the test div node");
yield selectNode(".test-element", inspector);
info("Testing the the background property on the .test-element rule");
yield testDivRuleView(view);
info("Testing that image preview tooltips show even when there are fields being edited");
yield testTooltipAppearsEvenInEditMode(view);
info("Switching over to the computed-view");
let {view} = yield openComputedView();
info("Testing that the background-image computed style has a tooltip too");
yield testComputedView(view);
});
function* testBodyRuleView(view) {
info("Testing tooltips in the rule view");
let panel = view.previewTooltip.panel;
// Check that the rule view has a tooltip and that a XUL panel has been created
ok(view.previewTooltip, "Tooltip instance exists");
ok(panel, "XUL panel exists");
// Get the background-image property inside the rule view
let {valueSpan} = getRuleViewProperty(view, "body", "background-image");
let uriSpan = valueSpan.querySelector(".theme-link");
yield assertHoverTooltipOn(view.previewTooltip, uriSpan);
let images = panel.getElementsByTagName("image");
is(images.length, 1, "Tooltip contains an image");
ok(images[0].getAttribute("src").indexOf("iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHe") !== -1,
"The image URL seems fine");
}
function* testDivRuleView(view) {
let panel = view.previewTooltip.panel;
// Get the background property inside the rule view
let {valueSpan} = getRuleViewProperty(view, ".test-element", "background");
let uriSpan = valueSpan.querySelector(".theme-link");
yield assertHoverTooltipOn(view.previewTooltip, uriSpan);
let images = panel.getElementsByTagName("image");
is(images.length, 1, "Tooltip contains an image");
ok(images[0].getAttribute("src").startsWith("data:"), "Tooltip contains a data-uri image as expected");
}
function* testTooltipAppearsEvenInEditMode(view) {
let panel = view.previewTooltip.panel;
info("Switching to edit mode in the rule view");
let editor = yield turnToEditMode(view);
info("Now trying to show the preview tooltip");
let {valueSpan} = getRuleViewProperty(view, ".test-element", "background");
let uriSpan = valueSpan.querySelector(".theme-link");
yield assertHoverTooltipOn(view.previewTooltip, uriSpan);
is(view.doc.activeElement, editor.input,
"Tooltip was shown in edit mode, and inplace-editor still focused");
}
function turnToEditMode(ruleView) {
let brace = ruleView.doc.querySelector(".ruleview-ruleclose");
return focusEditableField(brace);
}
function* testComputedView(view) {
let tooltip = view.tooltip;
ok(tooltip, "The computed-view has a tooltip defined");
let panel = tooltip.panel;
ok(panel, "The computed-view tooltip has a XUL panel");
let {valueSpan} = getComputedViewProperty(view, "background-image");
let uriSpan = valueSpan.querySelector(".theme-link");
yield assertHoverTooltipOn(view.tooltip, uriSpan);
let images = panel.getElementsByTagName("image");
is(images.length, 1, "Tooltip contains an image");
ok(images[0].getAttribute("src").startsWith("data:"), "Tooltip contains a data-uri in the computed-view too");
}