michael@0: /* vim: set ft=javascript ts=2 et sw=2 tw=80: */ michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: "use strict"; michael@0: michael@0: // Testing various inplace-editor behaviors in the rule-view michael@0: michael@0: let TEST_URL = 'url("' + TEST_URL_ROOT + 'doc_test_image.png")'; michael@0: let PAGE_CONTENT = [ michael@0: '', michael@0: '
Styled Node
' michael@0: ].join("\n"); michael@0: michael@0: let test = asyncTest(function*() { michael@0: yield addTab("data:text/html,test rule view user changes"); michael@0: michael@0: info("Creating the test document"); michael@0: content.document.body.innerHTML = PAGE_CONTENT; michael@0: michael@0: info("Opening the rule-view"); michael@0: let {toolbox, inspector, view} = yield openRuleView(); michael@0: michael@0: info("Selecting the test element"); michael@0: yield selectNode("#testid", inspector); michael@0: michael@0: yield testCancelNew(view); michael@0: }); michael@0: michael@0: function* testCancelNew(view) { michael@0: info("Test adding a new rule to the element's style declaration and leaving it empty."); michael@0: michael@0: let elementRuleEditor = view.element.children[0]._ruleEditor; michael@0: michael@0: info("Focusing a new property name in the rule-view"); michael@0: let editor = yield focusEditableField(elementRuleEditor.closeBrace); michael@0: is(inplaceEditor(elementRuleEditor.newPropSpan), editor, "The new property editor got focused"); michael@0: michael@0: info("Bluring the editor input"); michael@0: let onBlur = once(editor.input, "blur"); michael@0: editor.input.blur(); michael@0: yield onBlur; michael@0: michael@0: info("Checking the state of canceling a new property name editor"); michael@0: ok(!elementRuleEditor.rule._applyingModifications, "Shouldn't have an outstanding request after a cancel."); michael@0: is(elementRuleEditor.rule.textProps.length, 0, "Should have canceled creating a new text property."); michael@0: ok(!elementRuleEditor.propertyList.hasChildNodes(), "Should not have any properties."); michael@0: }