Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Remove CC referral banner (#2667)

Olga Bulatc7b76139d5a0
diff --git a/frontend/nuxt.config.ts b/frontend/nuxt.config.ts
index 3306bd2ab..10e34c8d0 100644
--- a/frontend/nuxt.config.ts
+++ b/frontend/nuxt.config.ts
@@ -135,7 +135,6 @@ const config: NuxtConfig = {
{ path: "~/components", extensions: ["vue"], pathPrefix: false },
],
plugins: [
- "~/plugins/migration-notice.ts",
"~/plugins/ua-parse.ts",
"~/plugins/focus-visible.client.ts",
"~/plugins/api-token.server.ts",
diff --git a/frontend/src/components/VBanner/VBanners.vue b/frontend/src/components/VBanner/VBanners.vue
index 3298bb8e2..426dfb108 100644
--- a/frontend/src/components/VBanner/VBanners.vue
+++ b/frontend/src/components/VBanner/VBanners.vue
@@ -1,11 +1,6 @@
<template>
<div>
<div v-show="showBanners" class="flex flex-col gap-2 p-2 pb-0">
- <VMigrationNotice
- v-if="shouldShowMigrationBanner"
- :variant="variant"
- @close="dismissBanner('cc-referral')"
- />
<VAnalyticsNotice
v-if="shouldShowAnalyticsBanner"
:variant="variant"
@@ -32,16 +27,13 @@ import type { TranslationBannerId, BannerId } from "~/types/banners"
export default defineComponent({
name: "VBanners",
components: {
- VMigrationNotice: () => import("~/components/VBanner/VMigrationNotice.vue"),
VTranslationStatusBanner: () =>
import("~/components/VBanner/VTranslationStatusBanner.vue"),
VAnalyticsNotice: () => import("~/components/VBanner/VAnalyticsNotice.vue"),
},
setup() {
const uiStore = useUiStore()
- const shouldShowMigrationBanner = computed(
- () => uiStore.shouldShowMigrationBanner
- )
+
const shouldShowTranslationBanner = computed(
() => uiStore.shouldShowTranslationBanner
)
@@ -63,16 +55,13 @@ export default defineComponent({
}
const showBanners = computed(() =>
- [
- shouldShowMigrationBanner,
- shouldShowTranslationBanner,
- shouldShowAnalyticsBanner,
- ].some((item) => item.value)
+ [shouldShowTranslationBanner, shouldShowAnalyticsBanner].some(
+ (item) => item.value
+ )
)
return {
translationBannerId,
- shouldShowMigrationBanner,
shouldShowTranslationBanner,
shouldShowAnalyticsBanner,
showBanners,
diff --git a/frontend/src/components/VBanner/VMigrationNotice.vue b/frontend/src/components/VBanner/VMigrationNotice.vue
deleted file mode 100644
index a693ab87c..000000000
--- a/frontend/src/components/VBanner/VMigrationNotice.vue
+++ /dev/null
@@ -1,39 +0,0 @@
-<template>
- <VNotificationBanner
- v-bind="$attrs"
- id="cc-referral"
- nature="info"
- :close-button-label="$t('migrationNotice.close')"
- @close="$emit('close')"
- >
- {{
- $t("migrationNotice.intro", {
- ccSearch: "CC Search",
- openverse: "Openverse",
- wordpress: "WordPress",
- })
- }}
- <i18n tag="span" path="migrationNotice.more">
- <template #readMore>
- <VLink
- class="text-curr underline"
- href="https://wordpress.org/news/2021/05/welcome-to-openverse/"
- >{{ $t("migrationNotice.read") }}</VLink
- >
- </template>
- </i18n>
- </VNotificationBanner>
-</template>
-
-<script lang="ts">
-import { defineComponent } from "vue"
-
-import VNotificationBanner from "~/components/VBanner/VNotificationBanner.vue"
-import VLink from "~/components/VLink.vue"
-
-export default defineComponent({
- name: "VMigrationNotice",
- components: { VLink, VNotificationBanner },
- inheritAttrs: false,
-})
-</script>
diff --git a/frontend/src/locales/scripts/en.json5 b/frontend/src/locales/scripts/en.json5
index df22a606d..68e6f5d14 100644
--- a/frontend/src/locales/scripts/en.json5
+++ b/frontend/src/locales/scripts/en.json5
@@ -648,12 +648,6 @@
arrowLabel: "Dropdown",
},
},
- migrationNotice: {
- intro: "{ccSearch} is now called {openverse} and joins {wordpress} as an open source project.",
- more: "{readMore} about this announcement.",
- read: "Read more",
- close: "Close the announcement",
- },
downloadButton: {
aria: {
dropdownLabel: "Select the download file format",
diff --git a/frontend/src/middleware/middleware.ts b/frontend/src/middleware/middleware.ts
index 9ab2128a0..3cfb68fbf 100644
--- a/frontend/src/middleware/middleware.ts
+++ b/frontend/src/middleware/middleware.ts
@@ -1,4 +1,3 @@
-import { useNavigationStore } from "~/stores/navigation"
import { useProviderStore } from "~/stores/provider"
import { useFeatureFlagStore } from "~/stores/feature-flag"
import { useUiStore } from "~/stores/ui"
@@ -26,14 +25,6 @@ const middleware: Middleware = async ({
query,
$pinia,
}: Context) => {
- /* Nav store */
-
- const navigationStore = useNavigationStore($pinia)
-
- if (process.client && navigationStore.isReferredFromCc) {
- navigationStore.setIsReferredFromCc(false)
- }
-
/* Provider store */
const providerStore = useProviderStore($pinia)
await providerStore.fetchMediaProviders()
diff --git a/frontend/src/plugins/migration-notice.ts b/frontend/src/plugins/migration-notice.ts
deleted file mode 100644
index eda56957b..000000000
--- a/frontend/src/plugins/migration-notice.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import { useNavigationStore } from "~/stores/navigation"
-
-import type { Plugin } from "@nuxt/types"
-
-/**
- * If the URL contains a referral parameter pointing containing
- * 'creativecommons.org' the migration notice needs to be displayed. This
- * plugin checks the presence of the param and updates the store.
- */
-const migrationNoticePlugin: Plugin = ({ query }) => {
- if (query.referrer) {
- useNavigationStore().setIsReferredFromCc(
- query.referrer.includes("creativecommons.org")
- )
- }
-}
-
-export default migrationNoticePlugin
diff --git a/frontend/src/stores/navigation.ts b/frontend/src/stores/navigation.ts
deleted file mode 100644
index 10f60b667..000000000
--- a/frontend/src/stores/navigation.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-import { defineStore } from "pinia"
-
-export interface NavigationState {
- isReferredFromCc: boolean
-}
-
-/**
- * Store information about navigation.
- */
-export const useNavigationStore = defineStore("navigation", {
- state: (): NavigationState => ({
- isReferredFromCc: false,
- }),
-
- /* Actions */
- actions: {
- setIsReferredFromCc(isReferredFromCc = true) {
- this.isReferredFromCc = isReferredFromCc
- },
- },
-})
diff --git a/frontend/src/stores/ui.ts b/frontend/src/stores/ui.ts
index 8894aa873..107b6a387 100644
--- a/frontend/src/stores/ui.ts
+++ b/frontend/src/stores/ui.ts
@@ -1,7 +1,5 @@
import { defineStore } from "pinia"
-import { useNavigationStore } from "~/stores/navigation"
-
import type { OpenverseCookieState, SnackbarState } from "~/types/cookies"
import type { BannerId, TranslationBannerId } from "~/types/banners"
@@ -110,17 +108,6 @@ export const useUiStore = defineStore("ui", {
needsTranslationBanner(this.currentLocale)
)
},
- /**
- * The migration banner is shown if the user is referred from CC Search,
- * and hasn't dismissed it yet.
- */
- shouldShowMigrationBanner(): boolean {
- const navigationStore = useNavigationStore()
- return (
- !this.dismissedBanners.includes("cc-referral") &&
- navigationStore.isReferredFromCc
- )
- },
/**
* The analytics banner is shown if the user hasn't dismissed it yet.
*/
diff --git a/frontend/src/types/banners.ts b/frontend/src/types/banners.ts
index 524d37298..4afcf5e19 100644
--- a/frontend/src/types/banners.ts
+++ b/frontend/src/types/banners.ts
@@ -1,4 +1,4 @@
import type { LocaleObject } from "@nuxtjs/i18n"
export type TranslationBannerId = `translation-${LocaleObject["code"]}`
-export type BannerId = TranslationBannerId | "cc-referral" | "analytics"
+export type BannerId = TranslationBannerId | "analytics"
diff --git a/frontend/src/utils/pinia-state.ts b/frontend/src/utils/pinia-state.ts
deleted file mode 100644
index bae247f1f..000000000
--- a/frontend/src/utils/pinia-state.ts
+++ /dev/null
@@ -1,60 +0,0 @@
-import { isClient } from "~/constants/window"
-
-import type { StateTree } from "pinia"
-
-/**
- * On the server, set the state to `initialState`.
- * On the client, reuse the server state that is saved as a property on `window.$nuxt.context`
- */
-export function initializeState<T>(storeId: string, initialState: T) {
- if (!isClient) {
- return initialState
- }
- const serverState = window?.$nuxt?.context?.$pinia?.state?.value
-
- return serverState &&
- serverState[storeId] &&
- Object.keys(serverState[storeId]).length > 0
- ? (JSON.parse(JSON.stringify(serverState[storeId].state)) as T)
- : initialState
-}
-
-/**
- * Check if the state in `window.$nuxt` contains a reactive value `refName` inside the `storeId` store.
- * @param serverState - the state object from `window.$nuxt`. Is null on the server.
- * @param storeId - the id of the store the refName is in.
- * @param refName - the name of a reactive store property to find.
- */
-const serverStateHasRef = (
- serverState: Record<string, StateTree> | null,
- storeId: string,
- refName: string
-) => {
- return Boolean(
- serverState &&
- serverState[storeId] &&
- Object.keys(serverState[storeId]).length > 0 &&
- refName in serverState[storeId]
- )
-}
-
-/**
- * Use this to hydrate the state if it's a collection of `ref`s or `reactive`s
- * instead of a single reactive `state` value.
- * @param storeId - the id of the store
- * @param refName - name of the state ref or reactive value
- * @param initialRef - initial value of the ref/reactive to be used if no value is available in the `nuxt.context`
- */
-export function initializeStateRef<T>(
- storeId: string,
- refName: string,
- initialRef: T
-) {
- if (!isClient) {
- return initialRef
- }
- const serverState = window?.$nuxt?.context?.$pinia?.state?.value
- return serverStateHasRef(serverState, storeId, refName)
- ? (JSON.parse(JSON.stringify(serverState[storeId][refName])) as T)
- : initialRef
-}
diff --git a/frontend/src/utils/send-message.ts b/frontend/src/utils/send-message.ts
deleted file mode 100644
index c0cc536f5..000000000
--- a/frontend/src/utils/send-message.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-import { isProd } from "~/utils/node-env"
-
-// TODO: set correct targetOrigin of the parent window
-const TARGET_ORIGIN = "*"
-
-interface Message<T extends ResizeValue | UrlChangeValue> {
- type: "resize" | "urlChange"
- value: T
-}
-
-interface ResizeValue {
- height: number
-}
-
-interface UrlChangeValue {
- path: string
- title: string
-}
-
-/**
- * Send message to the outer window. Can only be called on client-side
- * because it uses `window` object.
- * @param debug - whether to log the messages from the parent
- * @param message - the message to emit to the parent window
- */
-export const sendWindowMessage = <T extends UrlChangeValue | ResizeValue>({
- debug = !isProd,
- ...message
-}: { debug?: boolean } & Message<T>) => {
- if (window.parent !== window) {
- window.parent.postMessage({ debug, ...message }, TARGET_ORIGIN)
- }
-}
diff --git a/frontend/test/iframe-test.html b/frontend/test/iframe-test.html
deleted file mode 100644
index fd377613f..000000000
--- a/frontend/test/iframe-test.html
+++ /dev/null
@@ -1,118 +0,0 @@
-<!-- Simple test file for using Openverse in embedded mode -->
-<!-- @todo: Integrate with Playwright somehow and add dedicated e2e tests for the iframe -->
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="UTF-8" />
- <meta http-equiv="X-UA-Compatible" content="IE=edge" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <title>Openverse iFrame Testing</title>
- <!-- Styles stolen from: https://github.com/WordPress/wordpress.org/blob/master/wordpress.org/public_html/wp-content/themes/pub/wporg-openverse/css/openverse.css -->
- <style>
- #openverse_embed {
- display: block;
-
- width: 100%;
- height: var(
- --openverse-embed-height,
- 100vh
- ); /* This will be updated by JavaScript */
-
- border: none;
- }
- </style>
- </head>
- <body>
- <iframe
- id="openverse_embed"
- src="http://localhost:8443/"
- frameborder="0"
- ></iframe>
- <!-- Scripts stolen from: https://github.com/WordPress/wordpress.org/blob/master/wordpress.org/public_html/wp-content/themes/pub/wporg-openverse/js -->
- <script>
- const openverseSubpath = "http://localhost:8443/"
-
- /**
- * Update the height of the nested `iframe` to match the height of the nested
- * element. This function sets the value of the `--openverse-embed-height` CSS
- * custom property (which is `100vh`, by default).
- *
- * @param {{ height: number }} value - the new dimensions of the iframe
- */
- function updateHeight(value) {
- const height = value.height
- let heightProp
- if (height) {
- heightProp = `${height}px`
- } else {
- heightProp = "100vh"
- }
- document.documentElement.style.setProperty(
- "--openverse-embed-height",
- heightProp
- )
- }
-
- /**
- * Update the URL in the address bar when a page navigation occurs inside the
- * `iframe` This function uses the History API to change the address without a
- * page reload.
- *
- * @param {{
- * path: string,
- * title?: string,
- * state?: any,
- * }} value - the attributes of the new history state
- */
- function updatePath(value) {
- const path = value.path
- const url = `${openverseSubpath}${path}` // openverseSubpath defined in `index.php`
-
- console.log(`Replacing state URL: ${url}`)
- history.replaceState(value.state, value.title ?? "Openverse", url)
-
- if (value.title) {
- console.log(`Setting document title: ${value.title}`)
- document.title = value.title
- }
- }
-
- /**
- * This is the default handler for all messages received in this frame that do
- * not have a handler configured for them.
- */
- function logUnhandled() {
- console.error("No handler configured for event received")
- }
-
- /**
- * Responds to messages sent from the nested `iframe`.
- *
- * @param {MessageEvent<{
- * debug?: boolean,
- * type: string,
- * value: any,
- * }>} message - the message object sent to this document
- */
- function handleIframeMessages({ origin, data }) {
- if (data.debug) {
- console.log(`Received message from origin ${origin}:`)
- console.log(data)
- }
-
- let handler
-
- switch (data.type) {
- case "urlChange":
- handler = updatePath
- break
- default:
- handler = logUnhandled
- }
- handler(data.value)
- }
-
- window.addEventListener("message", handleIframeMessages)
- </script>
- </body>
-</html>
diff --git a/frontend/test/locales/ar.json b/frontend/test/locales/ar.json
index ccdfe3775..0744484ce 100644
--- a/frontend/test/locales/ar.json
+++ b/frontend/test/locales/ar.json
@@ -71,11 +71,6 @@
"dropdownLabel": "حدد تنسيق ملف التنزيل"
}
},
- "migrationNotice": {
- "intro": "{ccSearch} يسمى الآن {openverse} وينضم إلى {wordpress} كمشروع مفتوح المصدر.",
- "more": "{readMore} حول هذا الإعلان.",
- "read": "اقرأ أكثر"
- },
"dropdownButton": {
"aria": {
"arrowLabel": "اسقاط"
diff --git a/frontend/test/locales/es.json b/frontend/test/locales/es.json
index 4bffdf78f..4a6102a78 100644
--- a/frontend/test/locales/es.json
+++ b/frontend/test/locales/es.json
@@ -368,11 +368,6 @@
"content": "{openverse} es una herramienta que permite descubrir obras con licencia abierta y de dominio público y ser usadas por todos."
}
},
- "migrationNotice": {
- "intro": "{ccSearch} ahora se llama {openverse} y se une a {wordpress} como un proyecto de código abierto.",
- "read": "Lee más",
- "more": "{readMore} sobre este anuncio."
- },
"audioDetails": {
"information": "Información del audio",
"table": {
diff --git a/frontend/test/locales/ru.json b/frontend/test/locales/ru.json
index fc0f57a1a..86bed2bc9 100644
--- a/frontend/test/locales/ru.json
+++ b/frontend/test/locales/ru.json
@@ -276,9 +276,6 @@
"image": "изображение",
"occurred": "Произошла ошибка"
},
- "migrationNotice": {
- "read": "Читать далее"
- },
"dropdownButton": {
"aria": {
"arrowLabel": "Выпадающий список"
diff --git a/frontend/test/playwright/e2e/migration-banner.spec.ts b/frontend/test/playwright/e2e/migration-banner.spec.ts
deleted file mode 100644
index b12fbe11a..000000000
--- a/frontend/test/playwright/e2e/migration-banner.spec.ts
+++ /dev/null
@@ -1,66 +0,0 @@
-import { test, expect } from "@playwright/test"
-
-import { t } from "~~/test/playwright/utils/navigation"
-
-test.describe.configure({ mode: "parallel" })
-
-test.describe("migration banner", () => {
- test("shows migration banner on homepage", async ({ page }) => {
- await page.goto("/?referrer=creativecommons.org")
-
- const migrationNotice = page.locator('[data-testid="banner-cc-referral"]')
- const message = "CC Search is now called Openverse"
-
- await expect(migrationNotice).toContainText(message)
- await expect(migrationNotice).toBeVisible()
- })
-
- test("does not show migration banner if cookie dismissed value is saved", async ({
- context,
- page,
- }) => {
- await context.addCookies([
- {
- name: "uiDismissedBanners",
- value: '["cc-referral"]',
- domain: "localhost",
- path: "/",
- },
- ])
- await page.goto("/?referrer=creativecommons.org")
- const migrationNotice = page.locator('[data-testid="banner-cc-referral"]')
-
- await expect(migrationNotice).toBeHidden()
- })
-
- test("migration banner goes away on navigation", async ({ page }) => {
- await page.goto("/?referrer=creativecommons.org")
-
- const migrationNotice = page.locator('[data-testid="banner-cc-referral"]')
- await expect(migrationNotice).toBeVisible()
-
- // Navigate away from the page
- await Promise.all([
- page.locator("a.home-cell").first().click(),
- page.waitForLoadState("domcontentloaded"),
- ])
- await expect(migrationNotice).toBeHidden()
- })
-
- test("migration banner is dismissable and stays dismissed", async ({
- page,
- }) => {
- await page.goto("/?referrer=creativecommons.org")
-
- const migrationNotice = page.locator('[data-testid="banner-cc-referral"]')
- await expect(migrationNotice).toBeVisible({ timeout: 500 })
-
- await migrationNotice
- .locator(`[aria-label="${t("migrationNotice.close")}"]:visible`)
- .click({ timeout: 500 })
- await expect(migrationNotice).toBeHidden({ timeout: 500 })
-
- await page.reload()
- await expect(migrationNotice).toBeHidden({ timeout: 500 })
- })
-})
diff --git a/frontend/test/playwright/visual-regression/pages/search-with-banners.spec.ts-snapshots/page-with-all-banners-2xl-linux.png b/frontend/test/playwright/visual-regression/pages/search-with-banners.spec.ts-snapshots/page-with-all-banners-2xl-linux.png
index 94fef6eb2..88ddd40c7 100644
Binary files a/frontend/test/playwright/visual-regression/pages/search-with-banners.spec.ts-snapshots/page-with-all-banners-2xl-linux.png and b/frontend/test/playwright/visual-regression/pages/search-with-banners.spec.ts-snapshots/page-with-all-banners-2xl-linux.png differ
diff --git a/frontend/test/playwright/visual-regression/pages/search-with-banners.spec.ts-snapshots/page-with-all-banners-lg-linux.png b/frontend/test/playwright/visual-regression/pages/search-with-banners.spec.ts-snapshots/page-with-all-banners-lg-linux.png
index b124a573c..a9eaba5d3 100644
Binary files a/frontend/test/playwright/visual-regression/pages/search-with-banners.spec.ts-snapshots/page-with-all-banners-lg-linux.png and b/frontend/test/playwright/visual-regression/pages/search-with-banners.spec.ts-snapshots/page-with-all-banners-lg-linux.png differ
diff --git a/frontend/test/playwright/visual-regression/pages/search-with-banners.spec.ts-snapshots/page-with-all-banners-md-linux.png b/frontend/test/playwright/visual-regression/pages/search-with-banners.spec.ts-snapshots/page-with-all-banners-md-linux.png
index 7035c5ba0..bc3e23422 100644
Binary files a/frontend/test/playwright/visual-regression/pages/search-with-banners.spec.ts-snapshots/page-with-all-banners-md-linux.png and b/frontend/test/playwright/visual-regression/pages/search-with-banners.spec.ts-snapshots/page-with-all-banners-md-linux.png differ
diff --git a/frontend/test/playwright/visual-regression/pages/search-with-banners.spec.ts-snapshots/page-with-all-banners-sm-linux.png b/frontend/test/playwright/visual-regression/pages/search-with-banners.spec.ts-snapshots/page-with-all-banners-sm-linux.png
index 8654e6368..fb1803f87 100644
Binary files a/frontend/test/playwright/visual-regression/pages/search-with-banners.spec.ts-snapshots/page-with-all-banners-sm-linux.png and b/frontend/test/playwright/visual-regression/pages/search-with-banners.spec.ts-snapshots/page-with-all-banners-sm-linux.png differ
diff --git a/frontend/test/playwright/visual-regression/pages/search-with-banners.spec.ts-snapshots/page-with-all-banners-xl-linux.png b/frontend/test/playwright/visual-regression/pages/search-with-banners.spec.ts-snapshots/page-with-all-banners-xl-linux.png
index 25f6023a7..4f2ab8fc4 100644
Binary files a/frontend/test/playwright/visual-regression/pages/search-with-banners.spec.ts-snapshots/page-with-all-banners-xl-linux.png and b/frontend/test/playwright/visual-regression/pages/search-with-banners.spec.ts-snapshots/page-with-all-banners-xl-linux.png differ
diff --git a/frontend/test/playwright/visual-regression/pages/search-with-banners.spec.ts-snapshots/page-with-all-banners-xs-linux.png b/frontend/test/playwright/visual-regression/pages/search-with-banners.spec.ts-snapshots/page-with-all-banners-xs-linux.png
index 22592991b..8a3c127bd 100644
Binary files a/frontend/test/playwright/visual-regression/pages/search-with-banners.spec.ts-snapshots/page-with-all-banners-xs-linux.png and b/frontend/test/playwright/visual-regression/pages/search-with-banners.spec.ts-snapshots/page-with-all-banners-xs-linux.png differ
diff --git a/frontend/test/unit/specs/stores/nav-store.spec.js b/frontend/test/unit/specs/stores/nav-store.spec.js
deleted file mode 100644
index 3e31aea9c..000000000
--- a/frontend/test/unit/specs/stores/nav-store.spec.js
+++ /dev/null
@@ -1,30 +0,0 @@
-import { setActivePinia, createPinia } from "~~/test/unit/test-utils/pinia"
-
-import { useNavigationStore } from "~/stores/navigation"
-
-const initialState = {
- isReferredFromCc: false,
-}
-
-describe("Nav Store", () => {
- beforeEach(() => {
- setActivePinia(createPinia())
- })
- it("sets the initial state correctly", () => {
- const navigationStore = useNavigationStore()
- expect(navigationStore.isReferredFromCc).toEqual(
- initialState.isReferredFromCc
- )
- })
-
- it.each([true, false, undefined])(
- "sets isReferredFromCc",
- (isReferredFromCc) => {
- const navigationStore = useNavigationStore()
- navigationStore.setIsReferredFromCc(isReferredFromCc)
- const expectedValue = isReferredFromCc ?? true
-
- expect(navigationStore.isReferredFromCc).toEqual(expectedValue)
- }
- )
-})
diff --git a/frontend/test/unit/specs/stores/ui-store.spec.js b/frontend/test/unit/specs/stores/ui-store.spec.js
index 9a0de76ea..c901fd385 100644
--- a/frontend/test/unit/specs/stores/ui-store.spec.js
+++ b/frontend/test/unit/specs/stores/ui-store.spec.js
@@ -139,7 +139,7 @@ describe("Ui Store", () => {
it("initFromCookies sets initial state with a dismissed banner", () => {
const uiStore = useUiStore()
- const dismissedBanners = ["ru", "ar", "cc-referral"]
+ const dismissedBanners = ["ru", "ar"]
uiStore.initFromCookies({
uiDismissedBanners: dismissedBanners,
})
@@ -256,10 +256,10 @@ describe("Ui Store", () => {
}
)
it.each`
- originalState | bannerId | expectedState | areCookiesSet
- ${[]} | ${"es"} | ${["es"]} | ${true}
- ${["es"]} | ${"es"} | ${["es"]} | ${false}
- ${["cc-referral", "es"]} | ${"de"} | ${["cc-referral", "es", "de"]} | ${true}
+ originalState | bannerId | expectedState | areCookiesSet
+ ${[]} | ${"es"} | ${["es"]} | ${true}
+ ${["es"]} | ${"es"} | ${["es"]} | ${false}
+ ${["es"]} | ${"de"} | ${["es", "de"]} | ${true}
`(
"dismissBanner($bannerId): $originalState -> $expectedState",
({ originalState, bannerId, expectedState, areCookiesSet }) => {
@@ -279,10 +279,10 @@ describe("Ui Store", () => {
}
)
it.each`
- originalState | bannerId | expectedState
- ${[]} | ${"es"} | ${false}
- ${["es"]} | ${"es"} | ${true}
- ${["cc-referral", "es"]} | ${"de"} | ${false}
+ originalState | bannerId | expectedState
+ ${[]} | ${"es"} | ${false}
+ ${["es"]} | ${"es"} | ${true}
+ ${["es"]} | ${"de"} | ${false}
`(
"isBannerDismissed($bannerId) for $originalState returns $expectedState",
({ originalState, bannerId, expectedState }) => {