blob: 9e957fae318d983545c2eb9b8b350415b4bd52e8 [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 client can call undo multiple times with non-empty history.\n`);
await TestRunner.loadModule('elements_test_runner');
await TestRunner.showPanel('elements');
await TestRunner.loadHTML(`
<div style="display:none" id="container">
</div>
`);
var containerNode;
ElementsTestRunner.expandElementsTree(step1);
function step1(node) {
containerNode = ElementsTestRunner.expandedNodeWithId('container');
TestRunner.addResult('========= Original ========');
ElementsTestRunner.dumpElementsTree(containerNode);
step2();
}
function step2() {
function callback() {
TestRunner.addResult('===== Modified element =====');
ElementsTestRunner.dumpElementsTree(containerNode);
step3();
}
containerNode.setAttribute('', 'foo="bar"', callback);
}
async function step3() {
await SDK.domModelUndoStack.undo();
TestRunner.addResult('===== Undo 1 =====');
ElementsTestRunner.dumpElementsTree(containerNode);
TestRunner.addResult('===== Undo 2 =====');
ElementsTestRunner.dumpElementsTree(containerNode);
TestRunner.completeTest();
}
})();