From 04d7d081abf6b59d777f2c651b9fbc4522361d43 Mon Sep 17 00:00:00 2001 From: Tal Weinfeld Date: Mon, 16 Aug 2021 17:18:37 +0300 Subject: [PATCH 1/2] fixed jfrog issues --- .github/workflows/deploy-showcase-dev-s3.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy-showcase-dev-s3.yml b/.github/workflows/deploy-showcase-dev-s3.yml index a4922752db..70a476d813 100644 --- a/.github/workflows/deploy-showcase-dev-s3.yml +++ b/.github/workflows/deploy-showcase-dev-s3.yml @@ -12,6 +12,7 @@ jobs: env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_B }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY_SECRET_B }} + GITHUB_TOKEN: ${{ secrets.VNG_VIVID_PAT }} steps: - name: Checkout @@ -22,6 +23,8 @@ jobs: with: node-version: 14 + - run: printf "registry=https://npm.pkg.github.com/Vonage\n_authToken=\${GITHUB_TOKEN}\n//npm.pkg.github.com/:_authToken=\${GITHUB_TOKEN}\nalways-auth=true" > .npmrc + - name: Install yarn run: npm install -g yarn @@ -40,10 +43,6 @@ jobs: - name: Install dependencies if: steps.yarn-cache.outputs.cache-hit != 'true' - env: - yarn_always_auth: true, - yarn__auth: ${{ secrets.ARTIFACTORY_AUTH_TOKEN }} - yarn_registry: "https://vonagecc.jfrog.io/vonagecc/api/npm/npm/" run: yarn install - name: Build storybook From 0334990e37f3b866e074c3c37456ff22e0d87c56 Mon Sep 17 00:00:00 2001 From: yonatankra Date: Wed, 20 Oct 2021 14:41:55 +0300 Subject: [PATCH 2/2] fix(button): prevent double click inside a form --- components/button/src/vwc-button.ts | 8 +++++-- components/button/test/button.test.js | 30 +++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/components/button/src/vwc-button.ts b/components/button/src/vwc-button.ts index f9230e61d8..e443fa80a8 100644 --- a/components/button/src/vwc-button.ts +++ b/components/button/src/vwc-button.ts @@ -134,7 +134,7 @@ export class VWCButton extends MWCButton { // return nothing } - protected _handleClick(): void { + protected _handleClick(event: MouseEvent): void { if (this.form) { switch (this.getAttribute('type')) { case 'reset': @@ -143,7 +143,11 @@ export class VWCButton extends MWCButton { case 'button': break; default: - this.#_hiddenButton.click(); + if (event.target === this) { + this.#_hiddenButton.click(); + } else { + event.stopImmediatePropagation(); + } break; } } diff --git a/components/button/test/button.test.js b/components/button/test/button.test.js index 823c02db17..379f3d4be1 100644 --- a/components/button/test/button.test.js +++ b/components/button/test/button.test.js @@ -75,6 +75,36 @@ describe('button', () => { expect(submitted).to.equal(true); }); + it('should emit a click event only once when inside a form', async function () { + let clicked = 0; + const addedElements = addElement( + textToDomToParent( + `
<${COMPONENT_NAME} type="submit">Button Text
` + ) + ); + await waitNextTask(); + const formElement = addedElements[0]; + const actualElement = formElement.firstChild; + actualElement.addEventListener('click', () => (clicked++)); + + actualElement.click(); + expect(clicked).to.equal(1); + }); + + it('should emit a click event only once when outside a form', async function () { + let clicked = 0; + const [actualElement] = addElement( + textToDomToParent( + `<${COMPONENT_NAME} type="submit">Button Text` + ) + ); + await waitNextTask(); + actualElement.addEventListener('click', () => (clicked++)); + + actualElement.click(); + expect(clicked).to.equal(1); + }); + it('should reset form when of type reset', async function () { let submitted = false; let reset = false;