blob: 7407487a4eb4ec4bcfb0eb3b66f13a3e532f2941 [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 DOMAgent.setOuterHTML protocol method against an XHTML document.\n`);
await TestRunner.loadModule('elements_test_runner');
await TestRunner.showPanel('elements');
await TestRunner.navigatePromise('resources/set-outer-html-for-xhtml.xhtml');
await TestRunner.evaluateInPagePromise(`
document.getElementById("identity").wrapperIdentity = "identity";
`);
TestRunner.runTestSuite([
function testSetUp(next) {
ElementsTestRunner.setUpTestSuite(next);
},
function testChangeCharacterData(next) {
ElementsTestRunner.patchOuterHTML('Getting involved', 'Getting not involved', next);
},
function testChangeAttributes(next) {
ElementsTestRunner.patchOuterHTML('<a href', '<a foo="bar" href', next);
},
function testRemoveLastChild(next) {
ElementsTestRunner.patchOuterHTML('Getting involved', '', next);
},
function testSplitNode(next) {
ElementsTestRunner.patchOuterHTML('Getting involved', 'Getting</h2><h2>involved', next);
},
function testChangeNodeName(next) {
ElementsTestRunner.patchOuterHTML('<h2>Getting involved</h2>', '<h3>Getting involved</h3>', next);
},
async function testInvalidDocumentDoesNotCrash(next) {
var htmlId = ElementsTestRunner.expandedNodeWithId('html').id;
await TestRunner.DOMAgent.setOuterHTML(htmlId, 'foo');
TestRunner.addResult('PASS: No crash');
next();
}
]);
})();