From 59d9ed4403795c27bbe9497349df94e7a58ed67c Mon Sep 17 00:00:00 2001 From: Igor Guastalla Date: Mon, 20 Jul 2020 21:57:10 -0300 Subject: [PATCH] test: add 100% coverage. modify form test. update version --- package.json | 4 +- src/components/VuePaycard.vue | 3 +- tests/unit/form.vue | 11 ++- tests/unit/vue-paycard.spec.js | 143 ++++++++++++++++++++++++++++----- 4 files changed, 135 insertions(+), 26 deletions(-) diff --git a/package.json b/package.json index 5a00832..feb0b9c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-paycard", - "version": "0.1.2", + "version": "0.2.0", "private": false, "description": "Credit card component made with Vue.js", "homepage": "https://github.com/guastallaigor/vue-paycard#readme", @@ -93,7 +93,7 @@ "preset": "@vue/cli-plugin-unit-jest", "coverageDirectory": "./coverage/", "collectCoverage": true, - "coveragePathIgnorePatterns": ["/node_modules/", "/form.vue/", "/src/assets/"] + "coveragePathIgnorePatterns": ["/node_modules/", "/tests/", "/src/assets/"] }, "gitHooks": { "pre-commit": "lint-staged" diff --git a/src/components/VuePaycard.vue b/src/components/VuePaycard.vue index 1ff4fe2..f5943f8 100644 --- a/src/components/VuePaycard.vue +++ b/src/components/VuePaycard.vue @@ -307,10 +307,11 @@ export default { }) element[event]('blur', () => { this.isCardFlipped = !element.id === this.inputFields.cardCvv - setTimeout(() => { + const timeout = setTimeout(() => { if (!self.isFocused) { self.currentFocus = null } + clearTimeout(timeout) }, 300) self.isFocused = false }) diff --git a/tests/unit/form.vue b/tests/unit/form.vue index dca3f0a..0a9b0a0 100644 --- a/tests/unit/form.vue +++ b/tests/unit/form.vue @@ -1,9 +1,7 @@