blob: b1b58a03e37f53f9cc6f44ad5735cb613e153332 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
// Copyright 2018 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.
#include "third_party/blink/renderer/core/dom/element.h"
#include "third_party/blink/renderer/core/editing/testing/editing_test_base.h"
#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h"
namespace blink {
class ElementInnerTest : public testing::WithParamInterface<bool>,
private ScopedLayoutNGForTest,
public EditingTestBase {
protected:
ElementInnerTest() : ScopedLayoutNGForTest(GetParam()) {}
bool LayoutNGEnabled() const { return GetParam(); }
};
INSTANTIATE_TEST_CASE_P(All, ElementInnerTest, testing::Bool());
// http://crbug.com/877498
TEST_P(ElementInnerTest, ListItemWithLeadingWhiteSpace) {
SetBodyContent("<li id=target> abc</li>");
Element& target = *GetDocument().getElementById("target");
if (!LayoutNGEnabled()) {
// TODO(crbug.com/908339) Actual result should be "abc", no leading space.
EXPECT_EQ(" abc", target.innerText());
return;
}
EXPECT_EQ("abc", target.innerText());
}
// http://crbug.com/877470
TEST_P(ElementInnerTest, SVGElementAsTableCell) {
SetBodyContent(
"<div id=target>abc"
"<svg><rect style='display:table-cell'></rect></svg>"
"</div>");
Element& target = *GetDocument().getElementById("target");
EXPECT_EQ("abc", target.innerText());
}
// http://crbug.com/878725
TEST_P(ElementInnerTest, SVGElementAsTableRow) {
SetBodyContent(
"<div id=target>abc"
"<svg><rect style='display:table-row'></rect></svg>"
"</div>");
Element& target = *GetDocument().getElementById("target");
EXPECT_EQ("abc", target.innerText());
}
} // namespace blink
|