diff --git a/content.css b/content.css index 7fad1e6..a804d96 100644 --- a/content.css +++ b/content.css @@ -1,9 +1,8 @@ -.x-geoblock-hidden:is(article), .x-geoblock-hidden > article { display: none !important; } -.x-geoblock-hidden.x-geoblock-revealed:is(article), .x-geoblock-hidden.x-geoblock-revealed > article { display: block !important; } +.x-geoblock-hidden:not(.x-geoblock-revealed) > :not(.x-geoblock-placeholder) { display: none !important; } .x-geoblock-placeholder { width: 100%; padding: 14px 16px; border: 0; border-bottom: 1px solid rgb(47, 51, 54); background: transparent; color: rgb(113, 118, 123); font: 14px/20px system-ui, sans-serif; cursor: pointer; text-align: center; } -.x-geoblock-hidden:not(.x-geoblock-revealed) > .x-geoblock-placeholder { display: block; } +.x-geoblock-hidden:not(.x-geoblock-revealed) > .x-geoblock-placeholder { display: block !important; } .x-geoblock-hidden.x-geoblock-revealed > .x-geoblock-placeholder { display: block; opacity: .7; } diff --git a/tests/extension-flow.test.js b/tests/extension-flow.test.js index c308116..ccfd114 100644 --- a/tests/extension-flow.test.js +++ b/tests/extension-flow.test.js @@ -8,7 +8,7 @@ const parser = require("../lib/parser.js"); const contentSource = fs.readFileSync(require.resolve("../content.js"), "utf8"); const pageBridgeSource = fs.readFileSync(require.resolve("../page-bridge.js"), "utf8"); -function createContext(html, pathname, sendMessage) { +function createContext(html, pathname, sendMessage, storedSettings = {}) { const { window, document } = parseHTML(html); const runtimeListeners = []; const context = { @@ -16,7 +16,7 @@ function createContext(html, pathname, sendMessage) { location: { pathname, href: `https://x.com${pathname}`, origin: "https://x.com" }, chrome: { storage: { - sync: { get: async (defaults) => ({ ...defaults, enabled: true, blacklist: ["United States"] }) }, + sync: { get: async (defaults) => ({ ...defaults, enabled: true, blacklist: ["United States"], ...storedSettings }) }, onChanged: { addListener() {} } }, runtime: { @@ -76,20 +76,26 @@ test("blacklisted profile owner post is hidden", async () => { const { document } = createContext(`
-
`, "/ShitskinBlud/with_replies", async (message) => { assert.equal(message.type, "lookup-user"); assert.equal(message.username, "ShitskinBlud"); assert.equal(message.followingHint, false); return { ok: true, country: "United States", following: false, blocked: true }; - }); + }, { showPlaceholder: true }); await new Promise((resolve) => setTimeout(resolve, 20)); const article = document.querySelector("article"); assert.equal(article.dataset.xGeoBlockState, "blocked"); assert.equal(article.dataset.xGeoBlockCountry, "United States"); - assert.equal(article.closest('[data-testid="cellInnerDiv"]').classList.contains("x-geoblock-hidden"), true); + const container = article.closest('[data-testid="cellInnerDiv"]'); + assert.equal(container.classList.contains("x-geoblock-hidden"), true); + assert.equal(container.querySelector(":scope > :not(.x-geoblock-placeholder)"), article.parentElement); + const placeholder = container.querySelector(":scope > .x-geoblock-placeholder"); + assert.ok(placeholder); + placeholder.click(); + assert.equal(container.classList.contains("x-geoblock-revealed"), true); }); test("page bridge performs the authenticated AboutAccountQuery", async () => {