Skip to content

Commit

Permalink
Version 1.29.0 (#1069)
Browse files Browse the repository at this point in the history
## Version 1.29.0
### Features
- Added support for passing Answers Agents in the HTTP header (#1056)
- Added support for adding custom autocomplete prompts (#1040)
- Added RTF truncation support (#1060, #1061)

### Changes
- Updated default `vertical-grid` universal limit to 3 (#1048)

### Bug Fixes
- Fixed filters and footer overlap on desktop view (#806)
- Fixed `CollapsibleFilters` tab order (#1057)
- Fixed text truncation in the accordion card (#1065)
- Updated iframe tab navigation to keep parent’s domain (#1067)
  • Loading branch information
nmanu1 authored May 10, 2022
2 parents c720b43 + c818d20 commit 91184f5
Show file tree
Hide file tree
Showing 76 changed files with 17,779 additions and 9,626 deletions.
25 changes: 6 additions & 19 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,9 @@ on:
pull_request:

jobs:
Coveralls:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [15.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npx jest tests/static/ --coverage
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
call_coveralls:
uses: yext/slapshot-reusable-workflows/.github/workflows/coverage.yml@v1
with:
test_script: npx jest tests/static/ --coverage
secrets:
caller_github_token: ${{ secrets.GITHUB_TOKEN }}
118 changes: 37 additions & 81 deletions .github/workflows/percy-snapshots.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Percy Snapshots

on:
on:
push:
branches-ignore: dev/*
pull_request:
Expand All @@ -14,90 +14,46 @@ jobs:
- id: nonce
run: echo "::set-output name=result::${{ github.run_id }}-$(date +%s)"

default-snapshots:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.18]
call_snapshots_default:
needs: nonce
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run setup-test-site
- run: npm run build-test-site
- name: Percy snapshots
run: npx percy exec --parallel -- node tests/percy/index.js
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
PERCY_PARALLEL_NONCE: ${{ needs.nonce.outputs.result }}
PERCY_PARALLEL_TOTAL: 4
uses: yext/slapshot-reusable-workflows/.github/workflows/percy_snapshots.yml@v1
with:
build_script: npm run setup-test-site && npm run build-test-site
percy_script: npx percy exec --parallel -- node tests/percy/index.js
PERCY_PARALLEL_NONCE: ${{ needs.nonce.outputs.result }}
PERCY_PARALLEL_TOTAL: 4
secrets:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}

iframe-snapshots:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.18]
call_snapshots_iframe:
needs: nonce
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run setup-test-site
- run: npm run build-test-site
- name: Percy snapshots
run: npx percy exec --parallel -- node tests/percy/index.js iframe
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
PERCY_PARALLEL_NONCE: ${{ needs.nonce.outputs.result }}
PERCY_PARALLEL_TOTAL: 4
uses: yext/slapshot-reusable-workflows/.github/workflows/percy_snapshots.yml@v1
with:
build_script: npm run setup-test-site && npm run build-test-site
percy_script: npx percy exec --parallel -- node tests/percy/index.js iframe
PERCY_PARALLEL_NONCE: ${{ needs.nonce.outputs.result }}
PERCY_PARALLEL_TOTAL: 4
secrets:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}

spanish-snapshots:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.18]
call_snapshots_spanish:
needs: nonce
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run setup-test-site
- run: npm run build-test-site
- name: Percy snapshots
run: npx percy exec --parallel -- node tests/percy/index.js spanish
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
PERCY_PARALLEL_NONCE: ${{ needs.nonce.outputs.result }}
PERCY_PARALLEL_TOTAL: 4
uses: yext/slapshot-reusable-workflows/.github/workflows/percy_snapshots.yml@v1
with:
build_script: npm run setup-test-site && npm run build-test-site
percy_script: npx percy exec --parallel -- node tests/percy/index.js spanish
PERCY_PARALLEL_NONCE: ${{ needs.nonce.outputs.result }}
PERCY_PARALLEL_TOTAL: 4
secrets:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}

rtl-snapshots:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.18]
call_snapshots_rtl:
needs: nonce
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run setup-test-site
- run: npm run build-test-site
- name: Percy snapshots
run: npx percy exec --parallel -- node tests/percy/index.js rtl
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
PERCY_PARALLEL_NONCE: ${{ needs.nonce.outputs.result }}
PERCY_PARALLEL_TOTAL: 4
uses: yext/slapshot-reusable-workflows/.github/workflows/percy_snapshots.yml@v1
with:
build_script: npm run setup-test-site && npm run build-test-site
percy_script: npx percy exec --parallel -- node tests/percy/index.js rtl
PERCY_PARALLEL_NONCE: ${{ needs.nonce.outputs.result }}
PERCY_PARALLEL_TOTAL: 4
secrets:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
20 changes: 4 additions & 16 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,7 @@ name: Run Tests
on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12.x, 14.x, 15.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm test
call_run_tests:
uses: yext/slapshot-reusable-workflows/.github/workflows/run_tests.yml@v1
with:
build_script: ''
26 changes: 5 additions & 21 deletions .github/workflows/sync_develop_and_main.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,11 @@
name: create PR from main to develop
name: Create PR from main to develop

on:
push:
branches: [main, master]

permissions:
contents: read
pull-requests: write

jobs:
createPullRequest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: extract package version
id: vars
run: |
PACKAGE_VERSION="v$(cat ./package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g' | tr -d '[[:space:]]')"
echo ::set-output name=tag::${PACKAGE_VERSION}
- uses: repo-sync/pull-request@v2
with:
source_branch: "${{ github.event.repository.default_branch }}"
destination_branch: "develop"
pr_title: "Merge ${{ github.event.repository.default_branch }} (${{ steps.vars.outputs.tag }}) into develop"
pr_body: "Merge ${{ github.event.repository.default_branch }} (${{ steps.vars.outputs.tag }}) into develop"
github_token: ${{ secrets.GITHUB_TOKEN }}
call_sync_develop_and_main:
uses: yext/slapshot-reusable-workflows/.github/workflows/sync_develop_and_main.yml@v1
secrets:
caller_github_token: ${{ secrets.GITHUB_TOKEN }}
49 changes: 4 additions & 45 deletions .github/workflows/version-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,8 @@ on:
push:
branches: [release/*, hotfix/*]

permissions:
contents: write
pull-requests: write

jobs:
update-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- name: update package version
id: vars
run: |
BRANCH_NAME="${GITHUB_REF#refs/heads/}"
PACKAGE_VERSION="${GITHUB_REF##*/}"
echo ::set-output name=branch::${BRANCH_NAME}
if [[ $PACKAGE_VERSION =~ ^v[0-9]+\.[0-9]+(\.[0-9]+)?$ ]]
then
if [[ $PACKAGE_VERSION =~ ^v[0-9]+\.[0-9]+$ ]]
then
PACKAGE_VERSION="${PACKAGE_VERSION}.0"
fi
echo ::set-output name=version::${PACKAGE_VERSION}
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
if npm version ${PACKAGE_VERSION} | tee >( grep -q 'npm ERR! Version not changed' )
then
echo "Package version is already in sync with branch name."
echo ::set-output name=should_create_pr::0
exit 0
fi
echo ::set-output name=should_create_pr::1
git push -u origin HEAD:"dev/update-version-${PACKAGE_VERSION}"
else
echo "Branch name ${BRANCH_NAME} does not have the correct format with package version."
exit 1
fi
- name: create version update pr
if: steps.vars.outputs.should_create_pr == 1
uses: repo-sync/pull-request@v2
with:
source_branch: "dev/update-version-${{ steps.vars.outputs.version }}"
destination_branch: "${{ steps.vars.outputs.branch }}"
pr_title: "Update Package Version to ${{ steps.vars.outputs.version }}"
pr_body: "*An automated PR which updates the version number in package.json and package-lock.json files*"
github_token: ${{ secrets.GITHUB_TOKEN }}
call_version_update:
uses: yext/slapshot-reusable-workflows/.github/workflows/version_update.yml@v1
secrets:
caller_github_token: ${{ secrets.GITHUB_TOKEN }}
21 changes: 4 additions & 17 deletions .github/workflows/wcag_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,7 @@ on:
branches: [develop, hotfix/*, release/*, support/*]

jobs:
WCAG-test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run setup-test-site
- run: npm run build-test-site
- run: npm run wcag
call_wcag_test:
uses: yext/slapshot-reusable-workflows/.github/workflows/wcag_test.yml@v1
with:
build_script: npm run setup-test-site && npm run build-test-site
55 changes: 40 additions & 15 deletions cards/card_component.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,32 +80,57 @@ BaseCard["{{componentName}}"] = class extends ANSWERS.Component {

cardData.feedbackEnabled = ANSWERS.getAnalyticsOptIn() && cardData.feedback;

const { details, showMoreDetails } = cardData;

const cardDetails = details || '';
const cardShowMoreConfig = showMoreDetails || {};
const { showMoreLimit } = cardShowMoreConfig;

// Set the value of excessDetailsToggle. Note that it is not enough to have a showMoreLimit.
// The card's details must extend past this limit as well for the toggling to be enabled.
const showExcessDetailsToggle = showMoreLimit && cardDetails.length > showMoreLimit;

const truncatedDetails = showExcessDetailsToggle
? `${cardDetails.substring(0, showMoreLimit)}...`
: '';
const { showExcessDetailsToggle, truncatedDetails } =
this._getTruncatedDetails(cardData.details, cardData.showMoreDetails);

this.validateDataForRender(cardData);

return super.setState({
...data,
card: cardData,
showExcessDetailsToggle: showExcessDetailsToggle,
truncatedDetails: truncatedDetails,
showExcessDetailsToggle,
truncatedDetails,
cardName: `{{componentName}}`,
relativePath: `{{relativePath}}`
});
}

/**
* Returns whether to render the excess details toggle, and
* if so, the truncated details text.
*
* @param {string} details
* @param {Object} showMoreDetails
* @param {number} showMoreDetails.showMoreLimit
* @param {string} showMoreDetails.truncatedDetails
*/
_getTruncatedDetails(details = '', showMoreDetails = {}) {
const { showMoreLimit, truncatedDetails: userSpecifiedTruncatedDetails } = showMoreDetails;

if (userSpecifiedTruncatedDetails) {
const showExcessDetailsToggle = userSpecifiedTruncatedDetails.length < details.length
const truncatedDetails = showExcessDetailsToggle ? userSpecifiedTruncatedDetails : '';
return {
showExcessDetailsToggle,
truncatedDetails
}
}

const suffix = '...';

// Set the value of excessDetailsToggle. Note that it is not enough to have a showMoreLimit.
// The card's details must extend past this limit as well for the toggling to be enabled.
const showExcessDetailsToggle = showMoreLimit && (details.length + suffix.length > showMoreLimit);

const truncatedDetails = showExcessDetailsToggle
? details.substring(0, showMoreLimit) + suffix
: '';
return {
showExcessDetailsToggle,
truncatedDetails
};
}

validateDataForRender(data) {
if (!data){
console.error('Error: nothing returned from dataForRender');
Expand Down
Loading

0 comments on commit 91184f5

Please sign in to comment.