Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f3f752bea1 |
No files matched your search
@@ -45,11 +45,6 @@ function renderTop10() {
|
|||||||
el.querySelectorAll(".settings-addtoken-quick:not([disabled])").forEach(
|
el.querySelectorAll(".settings-addtoken-quick:not([disabled])").forEach(
|
||||||
(btn) => {
|
(btn) => {
|
||||||
btn.addEventListener("click", async () => {
|
btn.addEventListener("click", async () => {
|
||||||
// The button stays enabled until the first click's save ends.
|
|
||||||
if (isTracked(btn.dataset.address)) {
|
|
||||||
showFlash("Already tracked.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const token = {
|
const token = {
|
||||||
address: btn.dataset.address,
|
address: btn.dataset.address,
|
||||||
symbol: btn.dataset.symbol,
|
symbol: btn.dataset.symbol,
|
||||||
|
|||||||
@@ -3,9 +3,7 @@
|
|||||||
// (https://git.eeqj.de/sneak/AutistMask/issues/603). An answer while AddToken
|
// (https://git.eeqj.de/sneak/AutistMask/issues/603). An answer while AddToken
|
||||||
// still shows goes to AddressDetail. On either add-token screen, an answer for a
|
// still shows goes to AddressDetail. On either add-token screen, an answer for a
|
||||||
// token tracked while the lookup waited tracks nothing
|
// token tracked while the lookup waited tracks nothing
|
||||||
// (https://git.eeqj.de/sneak/AutistMask/issues/727). A second click on a "Top
|
// (https://git.eeqj.de/sneak/AutistMask/issues/727). Driven through the real
|
||||||
// tokens:" button tracks nothing
|
|
||||||
// (https://git.eeqj.de/sneak/AutistMask/issues/729). Driven through the real
|
|
||||||
// popup over a stored profile.
|
// popup over a stored profile.
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@@ -199,8 +197,6 @@ describe.each([
|
|||||||
await answerSecondClick();
|
await answerSecondClick();
|
||||||
expect(boot.text("flash-msg")).toBe(alreadyTrackedFlash);
|
expect(boot.text("flash-msg")).toBe(alreadyTrackedFlash);
|
||||||
expect(boot.storage.read("autistmask").trackedTokens).toEqual([TOKEN]);
|
expect(boot.storage.read("autistmask").trackedTokens).toEqual([TOKEN]);
|
||||||
const { state } = require("../src/shared/state");
|
|
||||||
expect(state.trackedTokens).toEqual([TOKEN]);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test("an answer for a token tracked while the lookup waited clears the status line", async () => {
|
test("an answer for a token tracked while the lookup waited clears the status line", async () => {
|
||||||
@@ -217,44 +213,3 @@ describe.each([
|
|||||||
expect(state.trackedTokens).toEqual([TOKEN]);
|
expect(state.trackedTokens).toEqual([TOKEN]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('a double click on a "Top tokens:" button tracks the token once', async () => {
|
|
||||||
const boot = await bootPopup(
|
|
||||||
unversionedValidProfile({
|
|
||||||
currentView: "address",
|
|
||||||
selectedWallet: 0,
|
|
||||||
selectedAddress: 0,
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
expect(boot.pageErrors).toEqual([]);
|
|
||||||
// The page stub does not turn the markup the screen draws into elements.
|
|
||||||
// So the list hands the screen a stand-in for TOKEN's button.
|
|
||||||
let press;
|
|
||||||
boot.node("settings-addtoken-top10").querySelectorAll = () => [
|
|
||||||
{
|
|
||||||
dataset: {
|
|
||||||
address: TOKEN.address,
|
|
||||||
symbol: TOKEN.symbol,
|
|
||||||
decimals: String(TOKEN.decimals),
|
|
||||||
name: TOKEN.name,
|
|
||||||
},
|
|
||||||
addEventListener: (name, fn) => {
|
|
||||||
press = fn;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
await boot.click("btn-settings");
|
|
||||||
await boot.click("btn-settings-add-token");
|
|
||||||
|
|
||||||
const firstClick = press();
|
|
||||||
const secondClick = press();
|
|
||||||
const { state } = require("../src/shared/state");
|
|
||||||
expect(state.trackedTokens).toEqual([TOKEN]);
|
|
||||||
// Read before the first click's save ends, when "Added TST" replaces it.
|
|
||||||
expect(boot.text("flash-msg")).toBe("Already tracked.");
|
|
||||||
|
|
||||||
await Promise.all([firstClick, secondClick]);
|
|
||||||
await boot.settle();
|
|
||||||
expect(state.trackedTokens).toEqual([TOKEN]);
|
|
||||||
expect(boot.storage.read("autistmask").trackedTokens).toEqual([TOKEN]);
|
|
||||||
});
|
|
||||||
Reference in new issue
Block a user