eslint: Fix unicorn/prefer-text-content.

https://github.com/sindresorhus/eslint-plugin-unicorn/blob/master/docs/rules/prefer-text-content.md

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2020-10-07 01:15:47 -07:00 committed by Tim Abbott
parent bd05f1c9f8
commit 70a0260ac1
6 changed files with 14 additions and 14 deletions

View File

@ -348,7 +348,7 @@ run_test("Enter key with text", () => {
preventDefault: noop,
stopPropagation: noop,
target: {
innerText: " yellow ",
textContent: " yellow ",
},
});
@ -407,7 +407,7 @@ run_test("insert_remove", () => {
key_handler({
keyCode: BACKSPACE,
target: {
innerText: "",
textContent: "",
},
preventDefault: noop,
});

View File

@ -386,7 +386,7 @@ class CommonUtils {
const messages = [];
$.map($el.find(".message_row .message_content"), (message_row) => {
messages.push(message_row.innerText.trim());
messages.push(message_row.textContent.trim());
});
data.push([key, messages]);

View File

@ -27,7 +27,7 @@ async function realm_creation_tests(page) {
await page.goto("http://" + host + "/confirmation_key/");
// Open the confirmation URL
const page_content = await page.evaluate(() => document.querySelector("body").innerText);
const page_content = await page.evaluate(() => document.querySelector("body").textContent);
const confirmation_key = await JSON.parse(page_content).confirmation_key;
const confirmation_url = "http://" + host + "/accounts/do_confirm/" + confirmation_key;
await page.goto(confirmation_url);
@ -43,7 +43,7 @@ async function realm_creation_tests(page) {
// Make sure the realm creation page is loaded correctly by
// checking the text in <p> tag under pitch class is as expected.
await page.waitForSelector(".pitch");
const text_in_pitch = await page.evaluate(() => document.querySelector(".pitch p").innerText);
const text_in_pitch = await page.evaluate(() => document.querySelector(".pitch p").textContent);
assert(text_in_pitch === "Youre almost there! We just need you to do one last thing.");
// fill the form.

View File

@ -815,7 +815,7 @@ exports.initialize = function () {
// wrong.
for (let x = 0; x < this.childNodes.length; x += 1) {
if (this.childNodes[x].nodeType !== 3) {
this.innerText = this.innerText.replace(/\n/, "");
this.textContent = this.textContent.replace(/\n/, "");
break;
}
}

View File

@ -49,12 +49,12 @@ exports.create = function (opts) {
const funcs = {
// return the value of the contenteditable input form.
value(input_elem) {
return input_elem.innerText;
return input_elem.textContent;
},
// clear the value of the input form.
clear(input_elem) {
input_elem.innerText = "";
input_elem.textContent = "";
},
clear_text() {

View File

@ -180,7 +180,7 @@ function populate_messages_sent_over_time(data) {
function add_hover_handler() {
document.querySelector("#id_messages_sent_over_time").on("plotly_hover", (data) => {
$("#hoverinfo").show();
document.querySelector("#hover_date").innerText =
document.querySelector("#hover_date").textContent =
data.points[0].data.text[data.points[0].pointNumber];
const values = [null, null, null];
data.points.forEach((trace) => {
@ -192,7 +192,7 @@ function populate_messages_sent_over_time(data) {
if (values[i] !== null) {
document.querySelector(hover_text_ids[i]).style.display = "inline";
document.querySelector(hover_value_ids[i]).style.display = "inline";
document.querySelector(hover_value_ids[i]).innerText = values[i];
document.querySelector(hover_value_ids[i]).textContent = values[i];
} else {
document.querySelector(hover_text_ids[i]).style.display = "none";
document.querySelector(hover_value_ids[i]).style.display = "none";
@ -726,7 +726,7 @@ function populate_number_of_users(data) {
function add_hover_handler() {
document.querySelector("#id_number_of_users").on("plotly_hover", (data) => {
$("#users_hover_info").show();
document.querySelector("#users_hover_date").innerText =
document.querySelector("#users_hover_date").textContent =
data.points[0].data.text[data.points[0].pointNumber];
const values = [null, null, null];
data.points.forEach((trace) => {
@ -740,7 +740,7 @@ function populate_number_of_users(data) {
for (let i = 0; i < values.length; i += 1) {
if (values[i] !== null) {
document.querySelector(hover_value_ids[i]).style.display = "inline";
document.querySelector(hover_value_ids[i]).innerText = values[i];
document.querySelector(hover_value_ids[i]).textContent = values[i];
} else {
document.querySelector(hover_value_ids[i]).style.display = "none";
}
@ -859,7 +859,7 @@ function populate_messages_read_over_time(data) {
function add_hover_handler() {
document.querySelector("#id_messages_read_over_time").on("plotly_hover", (data) => {
$("#read_hover_info").show();
document.querySelector("#read_hover_date").innerText =
document.querySelector("#read_hover_date").textContent =
data.points[0].data.text[data.points[0].pointNumber];
const values = [null, null];
data.points.forEach((trace) => {
@ -871,7 +871,7 @@ function populate_messages_read_over_time(data) {
if (values[i] !== null) {
document.querySelector(read_hover_text_ids[i]).style.display = "inline";
document.querySelector(read_hover_value_ids[i]).style.display = "inline";
document.querySelector(read_hover_value_ids[i]).innerText = values[i];
document.querySelector(read_hover_value_ids[i]).textContent = values[i];
} else {
document.querySelector(read_hover_text_ids[i]).style.display = "none";
document.querySelector(read_hover_value_ids[i]).style.display = "none";