blob: cf0a34ac48d5b4984e3cf266cc82947d119fedd5 [file] [log] [blame]
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
(async function() {
TestRunner.addResult(`Tests that adding an invalid property retains its syntax.\n`);
await TestRunner.loadModule('elements_test_runner');
await TestRunner.showPanel('elements');
await TestRunner.loadHTML(`
<div id="inspected" style="font-size: 12px">Text</div>
<div id="other"></div>
`);
ElementsTestRunner.selectNodeAndWaitForStyles('inspected', step1);
var treeElement;
var section;
async function step1() {
TestRunner.addResult('Before append:');
await ElementsTestRunner.dumpSelectedElementStyles(true);
section = ElementsTestRunner.inlineStyleSection();
// Create and increment.
treeElement = section.addNewBlankProperty();
treeElement.startEditing();
treeElement.nameElement.textContent = 'color';
treeElement.nameElement.dispatchEvent(TestRunner.createKeyEvent('Enter'));
// Update incrementally to a valid value.
treeElement.valueElement.textContent = 'rgb(';
treeElement.kickFreeFlowStyleEditForTest();
ElementsTestRunner.waitForStyleApplied(step2);
}
function step2() {
// Commit invalid value.
treeElement.valueElement.textContent = 'rgb(1';
ElementsTestRunner.waitForStyleApplied(step3);
treeElement.valueElement.dispatchEvent(TestRunner.createKeyEvent('Enter'));
}
function step3() {
ElementsTestRunner.selectNodeWithId('other', step4);
}
function step4() {
ElementsTestRunner.selectNodeAndWaitForStyles('inspected', step5);
}
async function step5() {
TestRunner.addResult('After append:');
await ElementsTestRunner.dumpSelectedElementStyles(true);
TestRunner.completeTest();
}
})();