mirror of https://github.com/zulip/zulip.git
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:
parent
bd05f1c9f8
commit
70a0260ac1
|
@ -348,7 +348,7 @@ run_test("Enter key with text", () => {
|
||||||
preventDefault: noop,
|
preventDefault: noop,
|
||||||
stopPropagation: noop,
|
stopPropagation: noop,
|
||||||
target: {
|
target: {
|
||||||
innerText: " yellow ",
|
textContent: " yellow ",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -407,7 +407,7 @@ run_test("insert_remove", () => {
|
||||||
key_handler({
|
key_handler({
|
||||||
keyCode: BACKSPACE,
|
keyCode: BACKSPACE,
|
||||||
target: {
|
target: {
|
||||||
innerText: "",
|
textContent: "",
|
||||||
},
|
},
|
||||||
preventDefault: noop,
|
preventDefault: noop,
|
||||||
});
|
});
|
||||||
|
|
|
@ -386,7 +386,7 @@ class CommonUtils {
|
||||||
|
|
||||||
const messages = [];
|
const messages = [];
|
||||||
$.map($el.find(".message_row .message_content"), (message_row) => {
|
$.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]);
|
data.push([key, messages]);
|
||||||
|
|
|
@ -27,7 +27,7 @@ async function realm_creation_tests(page) {
|
||||||
await page.goto("http://" + host + "/confirmation_key/");
|
await page.goto("http://" + host + "/confirmation_key/");
|
||||||
|
|
||||||
// Open the confirmation URL
|
// 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_key = await JSON.parse(page_content).confirmation_key;
|
||||||
const confirmation_url = "http://" + host + "/accounts/do_confirm/" + confirmation_key;
|
const confirmation_url = "http://" + host + "/accounts/do_confirm/" + confirmation_key;
|
||||||
await page.goto(confirmation_url);
|
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
|
// Make sure the realm creation page is loaded correctly by
|
||||||
// checking the text in <p> tag under pitch class is as expected.
|
// checking the text in <p> tag under pitch class is as expected.
|
||||||
await page.waitForSelector(".pitch");
|
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 === "You’re almost there! We just need you to do one last thing.");
|
assert(text_in_pitch === "You’re almost there! We just need you to do one last thing.");
|
||||||
|
|
||||||
// fill the form.
|
// fill the form.
|
||||||
|
|
|
@ -815,7 +815,7 @@ exports.initialize = function () {
|
||||||
// wrong.
|
// wrong.
|
||||||
for (let x = 0; x < this.childNodes.length; x += 1) {
|
for (let x = 0; x < this.childNodes.length; x += 1) {
|
||||||
if (this.childNodes[x].nodeType !== 3) {
|
if (this.childNodes[x].nodeType !== 3) {
|
||||||
this.innerText = this.innerText.replace(/\n/, "");
|
this.textContent = this.textContent.replace(/\n/, "");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,12 +49,12 @@ exports.create = function (opts) {
|
||||||
const funcs = {
|
const funcs = {
|
||||||
// return the value of the contenteditable input form.
|
// return the value of the contenteditable input form.
|
||||||
value(input_elem) {
|
value(input_elem) {
|
||||||
return input_elem.innerText;
|
return input_elem.textContent;
|
||||||
},
|
},
|
||||||
|
|
||||||
// clear the value of the input form.
|
// clear the value of the input form.
|
||||||
clear(input_elem) {
|
clear(input_elem) {
|
||||||
input_elem.innerText = "";
|
input_elem.textContent = "";
|
||||||
},
|
},
|
||||||
|
|
||||||
clear_text() {
|
clear_text() {
|
||||||
|
|
|
@ -180,7 +180,7 @@ function populate_messages_sent_over_time(data) {
|
||||||
function add_hover_handler() {
|
function add_hover_handler() {
|
||||||
document.querySelector("#id_messages_sent_over_time").on("plotly_hover", (data) => {
|
document.querySelector("#id_messages_sent_over_time").on("plotly_hover", (data) => {
|
||||||
$("#hoverinfo").show();
|
$("#hoverinfo").show();
|
||||||
document.querySelector("#hover_date").innerText =
|
document.querySelector("#hover_date").textContent =
|
||||||
data.points[0].data.text[data.points[0].pointNumber];
|
data.points[0].data.text[data.points[0].pointNumber];
|
||||||
const values = [null, null, null];
|
const values = [null, null, null];
|
||||||
data.points.forEach((trace) => {
|
data.points.forEach((trace) => {
|
||||||
|
@ -192,7 +192,7 @@ function populate_messages_sent_over_time(data) {
|
||||||
if (values[i] !== null) {
|
if (values[i] !== null) {
|
||||||
document.querySelector(hover_text_ids[i]).style.display = "inline";
|
document.querySelector(hover_text_ids[i]).style.display = "inline";
|
||||||
document.querySelector(hover_value_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 {
|
} else {
|
||||||
document.querySelector(hover_text_ids[i]).style.display = "none";
|
document.querySelector(hover_text_ids[i]).style.display = "none";
|
||||||
document.querySelector(hover_value_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() {
|
function add_hover_handler() {
|
||||||
document.querySelector("#id_number_of_users").on("plotly_hover", (data) => {
|
document.querySelector("#id_number_of_users").on("plotly_hover", (data) => {
|
||||||
$("#users_hover_info").show();
|
$("#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];
|
data.points[0].data.text[data.points[0].pointNumber];
|
||||||
const values = [null, null, null];
|
const values = [null, null, null];
|
||||||
data.points.forEach((trace) => {
|
data.points.forEach((trace) => {
|
||||||
|
@ -740,7 +740,7 @@ function populate_number_of_users(data) {
|
||||||
for (let i = 0; i < values.length; i += 1) {
|
for (let i = 0; i < values.length; i += 1) {
|
||||||
if (values[i] !== null) {
|
if (values[i] !== null) {
|
||||||
document.querySelector(hover_value_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 {
|
} else {
|
||||||
document.querySelector(hover_value_ids[i]).style.display = "none";
|
document.querySelector(hover_value_ids[i]).style.display = "none";
|
||||||
}
|
}
|
||||||
|
@ -859,7 +859,7 @@ function populate_messages_read_over_time(data) {
|
||||||
function add_hover_handler() {
|
function add_hover_handler() {
|
||||||
document.querySelector("#id_messages_read_over_time").on("plotly_hover", (data) => {
|
document.querySelector("#id_messages_read_over_time").on("plotly_hover", (data) => {
|
||||||
$("#read_hover_info").show();
|
$("#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];
|
data.points[0].data.text[data.points[0].pointNumber];
|
||||||
const values = [null, null];
|
const values = [null, null];
|
||||||
data.points.forEach((trace) => {
|
data.points.forEach((trace) => {
|
||||||
|
@ -871,7 +871,7 @@ function populate_messages_read_over_time(data) {
|
||||||
if (values[i] !== null) {
|
if (values[i] !== null) {
|
||||||
document.querySelector(read_hover_text_ids[i]).style.display = "inline";
|
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]).style.display = "inline";
|
||||||
document.querySelector(read_hover_value_ids[i]).innerText = values[i];
|
document.querySelector(read_hover_value_ids[i]).textContent = values[i];
|
||||||
} else {
|
} else {
|
||||||
document.querySelector(read_hover_text_ids[i]).style.display = "none";
|
document.querySelector(read_hover_text_ids[i]).style.display = "none";
|
||||||
document.querySelector(read_hover_value_ids[i]).style.display = "none";
|
document.querySelector(read_hover_value_ids[i]).style.display = "none";
|
||||||
|
|
Loading…
Reference in New Issue