Skip to content

Commit

Permalink
Merge branch 'arc-themes-release-version-2.1.0' into dependabot/npm_a…
Browse files Browse the repository at this point in the history
…nd_yarn/blocks/article-body-block/postcss-8.4.31
  • Loading branch information
nschubach authored Nov 9, 2023
2 parents 0324d0b + 5418d1e commit 9a9942b
Show file tree
Hide file tree
Showing 54 changed files with 32,879 additions and 43,530 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/security-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ jobs:
languages: ${{ matrix.language }}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2
2 changes: 1 addition & 1 deletion .github/workflows/stylelint-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Rep
uses: actions/checkout@v1
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/sync-themes-branch-with-themes-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run all tests
run: npm run test
#- name: Run all tests
# run: npm run test

# See confluence pages https://arcpublishing.atlassian.net/wiki/spaces/TI/pages/2983788608/How+To+Do+Product-Facing+Tag+Release and https://arcpublishing.atlassian.net/wiki/spaces/TI/pages/3013541978/Github+Actions+for+NodeJS+Standards+Best+Practices for documentation
- name: Publish to target tag based off of branch name
Expand Down
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
# npx lint-staged
3 changes: 2 additions & 1 deletion .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

# fetching latest changes `git fetch -a --depth 100` to ensure the base branch is up to date
git fetch -a --depth 100 && npm run lint:changed-feature-branch && npm run test:changed-feature-branch
# git fetch -a --depth 100 && npm run lint:changed-feature-branch && npm run test:changed-feature-branch
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14
20
11 changes: 6 additions & 5 deletions blocks/ads-block/features/ads/_children/AdUnit/index.test.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { mount } from "enzyme";
import { render } from "@testing-library/react";
import AdUnit from "./index";
import ArcAdsInstance from "../ArcAdsInstance";
import { setPageTargeting } from "../../ad-helper";
Expand Down Expand Up @@ -79,11 +79,12 @@ describe("<AdUnit/>", () => {
});

it("renders and registers ad unit on published page", () => {
const wrapper = mount(<AdUnit adConfig={AD_CONFIG_MOCK} featureConfig={FEATURE_CONFIG_MOCK} />);
expect(wrapper).toBeDefined();
const { container } = render(
<AdUnit adConfig={AD_CONFIG_MOCK} featureConfig={FEATURE_CONFIG_MOCK} />
);
// id with the ad config
const adUnitEl = wrapper.find(`#${AD_CONFIG_MOCK_ID}`);
expect(adUnitEl).toHaveLength(1);
const adUnitEl = container.querySelector(`#${AD_CONFIG_MOCK_ID}`);
expect(adUnitEl).not.toBeNull();

expect(ArcAdsInstance.getInstance).toHaveBeenCalledTimes(1);
expect(setPageTargeting).toBeCalledWith(expect.objectContaining(FEATURE_CONFIG_MOCK));
Expand Down
20 changes: 5 additions & 15 deletions blocks/ads-block/features/ads/_children/ArcAdminAd/index.test.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { mount } from "enzyme";
import { render, screen } from "@testing-library/react";
import ArcAdminAd from "./index";

const defaults = {
Expand All @@ -17,26 +17,16 @@ const defaults = {

describe("<ArcAdminAd>", () => {
it("renders with ad name", () => {
const wrapper = mount(<ArcAdminAd {...defaults.props} />);
expect(wrapper).toBeDefined();
const container = wrapper.find("div.b-ads-block--admin");
expect(container).toHaveLength(1);
const adNameEl = container.find("p").at(0);
expect(adNameEl).toHaveLength(1);
expect(adNameEl.text()).toEqual("test-ad-name");
render(<ArcAdminAd {...defaults.props} />);
expect(screen.getByText("test-ad-name")).not.toBeNull();
});

it("renders with default ad name", () => {
const adProps = {
...defaults.props,
adType: undefined,
};
const wrapper = mount(<ArcAdminAd {...adProps} />);
expect(wrapper).toBeDefined();
const container = wrapper.find("div.b-ads-block--admin");
expect(container).toHaveLength(1);
const adNameEl = container.find("p").at(0);

expect(adNameEl.text()).toEqual("Ad Name N/A");
render(<ArcAdminAd {...adProps} />);
expect(screen.getByText("Ad Name N/A")).not.toBeNull();
});
});
13 changes: 12 additions & 1 deletion blocks/ads-block/features/ads/ad-helper.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ describe("ad-helper", () => {
});

describe("getTags()", () => {
it('returns empty string with invalid "globalContent"', () => {
it("returns empty string with invalid 'globalContent'", () => {
const tags = getTags();
expect(tags).toBeDefined();
expect(tags).toBe("");
Expand All @@ -224,6 +224,17 @@ describe("ad-helper", () => {
expect(tags).toContain(tag.slug);
});
});
it("returns empty sting when tags are empty", () => {
const tags = getTags({
globalContent: {
taxonomy: {
tags: [{}, {}],
},
},
});
expect(tags).toBeDefined();
expect(tags).toBe("");
});
});

describe("getPageType()", () => {
Expand Down
2 changes: 1 addition & 1 deletion blocks/ads-block/features/ads/default.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const ArcAdDisplay = (props) => {
offsetLeft={0}
offsetRight={0}
offsetTop={200}
renderPlaceholder={(ref) => <div ref={ref} />}
renderPlaceholder={(ref) => <div data-testid="lazy-load-placeholder" ref={ref} />}
>
<AdUnit adConfig={config} featureConfig={propsWithContext} />
</LazyLoad>
Expand Down
105 changes: 42 additions & 63 deletions blocks/ads-block/features/ads/default.test.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import { useFusionContext } from "fusion:context";
import { mount } from "enzyme";
import { render, screen } from "@testing-library/react";
import ArcAd from "./default";

jest.mock("@wpmedia/arc-themes-components", () => ({
Expand Down Expand Up @@ -45,14 +45,9 @@ describe("<ArcAd>", () => {
});

it("renders no ad unit in admin dashboard", () => {
const wrapper = mount(<ArcAd {...AD_PROPS_MOCK} />);
expect(wrapper).toBeDefined();
const arcAdminAd = wrapper.find("ArcAdminAd");
expect(arcAdminAd.prop("adClass")).toEqual(AD_PROPS_MOCK.customFields.adType);
expect(arcAdminAd.prop("adType")).toEqual("cube");
expect(arcAdminAd.prop("slotName")).toEqual("news");
expect(typeof arcAdminAd.prop("dimensions")).toEqual("object");
expect(wrapper.find("AdUnit")).toHaveLength(0);
render(<ArcAd {...AD_PROPS_MOCK} />);
expect(screen.getByText("cube")).not.toBeNull();
expect(screen.queryByText(/ads-block.ad-label/)).toBeNull();
});
});

Expand All @@ -67,15 +62,8 @@ describe("<ArcAd>", () => {

describe("when lazy loading is disabled", () => {
it("renders ad unit with disabled lazy-load container", () => {
const wrapper = mount(<ArcAd {...AD_PROPS_MOCK} />);
expect(wrapper).toBeDefined();
const lazyLoaderEl = wrapper.find("LazyLoad");
expect(lazyLoaderEl).toHaveLength(1);
expect(lazyLoaderEl.prop("enabled")).toBe(false);
const adUnitEl = lazyLoaderEl.find("AdUnit");
expect(adUnitEl).toHaveLength(1);
expect(typeof adUnitEl.prop("adConfig")).toEqual("object");
expect(typeof adUnitEl.prop("featureConfig")).toEqual("object");
render(<ArcAd {...AD_PROPS_MOCK} />);
expect(screen.getByText(/ads-block.ad-label/)).not.toBeNull();
});
});

Expand All @@ -87,58 +75,49 @@ describe("<ArcAd>", () => {
lazyLoad: true,
},
};
const wrapper = mount(<ArcAd {...adProps} />);
expect(wrapper).toBeDefined();
const lazyLoaderEl = wrapper.find("LazyLoad");
expect(lazyLoaderEl).toHaveLength(1);
expect(lazyLoaderEl.prop("enabled")).toBe(true);
render(<ArcAd {...adProps} />);
expect(screen.getByTestId("lazy-load-placeholder")).not.toBeNull();
});
});
});

describe("Reserve Space", () => {
it("renders with width only", () => {
const adProps = {
...AD_PROPS_MOCK,
customFields: {
reserveSpace: false,
},
};
const wrapper = mount(<ArcAd {...adProps} />);
const adContainer = wrapper.find("div.b-ads-block > div");
expect(adContainer).toHaveLength(1);
expect(adContainer.prop("style").maxWidth).toBeDefined();
expect(adContainer.prop("style").minHeight).toBe(null);
});
describe("Reserve Space", () => {
it("renders with width only", () => {
const adProps = {
...AD_PROPS_MOCK,
customFields: {
reserveSpace: false,
},
};
const { container } = render(<ArcAd {...adProps} />);
const adContainer = container.querySelector("div.b-ads-block > div");
expect(adContainer.style.maxWidth).not.toBe("");
expect(adContainer.style.minHeight).toBe("");
});

it("renders with height and width", () => {
const wrapper = mount(<ArcAd {...AD_PROPS_MOCK} />);
const adContainer = wrapper.find("div.b-ads-block > div");
expect(adContainer).toHaveLength(1);
expect(adContainer.prop("style").maxWidth).toBeDefined();
expect(adContainer.prop("style").minHeight).not.toBe(null);
it("renders with height and width", () => {
const { container } = render(<ArcAd {...AD_PROPS_MOCK} />);
const adContainer = container.querySelector("div.b-ads-block > div");
expect(adContainer.style.maxWidth).not.toBe("");
expect(adContainer.style.minHeight).not.toBe("");
});
});
});

describe("Advertisement Label", () => {
it("renders no advertisement label when disabled", () => {
const adProps = {
...AD_PROPS_MOCK,
customFields: {
displayAdLabel: false,
},
};
const wrapper = mount(<ArcAd {...adProps} />);
const container = wrapper.find("div.b-ads-block");
expect(container).toHaveLength(1);
expect(container.text()).toEqual("");
});
describe("Advertisement Label", () => {
it("renders no advertisement label when disabled", () => {
const adProps = {
...AD_PROPS_MOCK,
customFields: {
displayAdLabel: false,
},
};
render(<ArcAd {...adProps} />);
expect(screen.queryByText(/ads-block.ad-label/)).toBeNull();
});

it("renders advertisement label when enabled", () => {
const wrapper = mount(<ArcAd {...AD_PROPS_MOCK} />);
const container = wrapper.find("div.b-ads-block");
expect(container).toHaveLength(1);
expect(container.text()).toEqual("ads-block.ad-label");
it("renders advertisement label when enabled", () => {
render(<ArcAd {...AD_PROPS_MOCK} />);
expect(screen.getByText(/ads-block.ad-label/)).not.toBeNull();
});
});
});
});
2 changes: 1 addition & 1 deletion blocks/ads-block/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"directory": "blocks/ads-block"
},
"dependencies": {
"arcads": "6.1.1"
"arcads": "6.2.0"
},
"peerDependencies": {
"@arc-fusion/prop-types": "^0.1.5",
Expand Down
2 changes: 1 addition & 1 deletion blocks/alert-bar-block/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@wpmedia/arc-themes-components": "*"
},
"dependencies": {
"cookie": "^0.4.1"
"cookie": "^0.5.0"
},
"gitHead": "83fb8d6685958d85ddbfcfbf01d9a5c864cd6c95"
}
2 changes: 1 addition & 1 deletion blocks/alert-bar-content-source-block/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"directory": "blocks/alert-bar-content-source-block"
},
"dependencies": {
"axios": "^1.3.5"
"axios": "^1.5.1"
},
"gitHead": "83fb8d6685958d85ddbfcfbf01d9a5c864cd6c95"
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
"directory": "blocks/algolia-assortment-content-source-block"
},
"dependencies": {
"algoliasearch": "^4.13.0"
"algoliasearch": "^4.20.0"
}
}
4 changes: 2 additions & 2 deletions blocks/article-body-block/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"@wpmedia/arc-themes-components": "*"
},
"dependencies": {
"react-oembed-container": "^1.0.0",
"sanitize-html": "^2.9.0"
"react-oembed-container": "^1.0.1",
"sanitize-html": "^2.11.0"
},
"gitHead": "83fb8d6685958d85ddbfcfbf01d9a5c864cd6c95"
}
2 changes: 1 addition & 1 deletion blocks/author-content-source-block/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"directory": "blocks/author-content-source-block"
},
"dependencies": {
"axios": "^1.3.5"
"axios": "^1.5.1"
},
"peerDependencies": {
"@wpmedia/arc-themes-components": "*",
Expand Down
2 changes: 1 addition & 1 deletion blocks/collections-content-source-block/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"directory": "blocks/collections-content-source-block"
},
"dependencies": {
"axios": "^1.3.5"
"axios": "^1.5.1"
},
"peerDependencies": {
"@wpmedia/arc-themes-components": "*",
Expand Down
2 changes: 1 addition & 1 deletion blocks/commerce-product-content-source-block/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
"directory": "blocks/commerce-product-content-source-block"
},
"dependencies": {
"axios": "^1.3.5"
"axios": "^1.5.1"
}
}
2 changes: 1 addition & 1 deletion blocks/content-api-source-block/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"directory": "blocks/content-api-source-block"
},
"dependencies": {
"axios": "^1.3.5"
"axios": "^1.5.1"
},
"peerDependencies": {
"@wpmedia/arc-themes-components": "*",
Expand Down
2 changes: 1 addition & 1 deletion blocks/header-nav-chain-block/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@wpmedia/arc-themes-components": "*"
},
"dependencies": {
"focus-trap-react": "^10.1.1",
"focus-trap-react": "^10.2.3",
"use-debounce": "^9.0.4"
},
"gitHead": "83fb8d6685958d85ddbfcfbf01d9a5c864cd6c95"
Expand Down
Loading

0 comments on commit 9a9942b

Please sign in to comment.