From 81df007ac54ef6a2585ea1aea07aa404f01c0ff4 Mon Sep 17 00:00:00 2001 From: Kovah Date: Tue, 2 Jul 2019 14:02:37 +0200 Subject: [PATCH 1/4] Improve submit disabling with form check (#53) --- resources/assets/js/components/LoadingButton.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/resources/assets/js/components/LoadingButton.js b/resources/assets/js/components/LoadingButton.js index 4a298d0e..773ad432 100644 --- a/resources/assets/js/components/LoadingButton.js +++ b/resources/assets/js/components/LoadingButton.js @@ -2,11 +2,18 @@ export default class LoadingButton { constructor ($el) { this.$el = $el; + this.$form = this.$el.form; this.$el.addEventListener('click', this.onClick.bind(this)) } onClick () { - this.$el.disabled = true; + if (this.formIsValid()) { + this.$el.disabled = true; + } + } + + formIsValid() { + return this.$form.checkValidity(); } } From 475a8e19b752a3eed4efea7eed4a7bad14213551 Mon Sep 17 00:00:00 2001 From: Kovah Date: Tue, 2 Jul 2019 14:13:10 +0200 Subject: [PATCH 2/4] Add npm build testing to Travis CI config --- .travis.yml | 31 +++++++++++++++++++++++-------- package.json | 3 ++- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7a194931..248cdc7c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,12 +2,27 @@ branches: only: - master -language: php -php: - - '7.1.3' - - '7.2' - - '7.3' +stages: + - test-backend + - test-frontend -install: - - cp .env.example .env - - composer install +jobs: + include: + - stage: test-backend + language: php + php: + - '7.1.3' + - '7.2' + - '7.3' + install: + - cp .env.example .env + - composer install + + - stage: test-frontend + language: nodejs + node_js: + - "10.15" + before_install: + - npm i + install: + - npm run build diff --git a/package.json b/package.json index 5df84b58..7496717e 100755 --- a/package.json +++ b/package.json @@ -14,7 +14,8 @@ }, "scripts": { "dev": "grunt dev", - "build": "grunt build" + "build": "grunt build", + "test": "grunt build" }, "devDependencies": { "autoprefixer": "^8.6.5", From 2ad98a2c24923ab088e494bbf1771637cce8e5f5 Mon Sep 17 00:00:00 2001 From: Kovah Date: Tue, 2 Jul 2019 14:50:28 +0200 Subject: [PATCH 3/4] Update frontend test process for Travis CI --- .nvmrc | 1 + .travis.yml | 6 +----- 2 files changed, 2 insertions(+), 5 deletions(-) create mode 100644 .nvmrc diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 00000000..f9fb144f --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +10.15.0 diff --git a/.travis.yml b/.travis.yml index 248cdc7c..3332923d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,8 +21,4 @@ jobs: - stage: test-frontend language: nodejs node_js: - - "10.15" - before_install: - - npm i - install: - - npm run build + - 'lts/*' From 6ecf8bf89fde259cf82d058db6cb8b349f714213 Mon Sep 17 00:00:00 2001 From: Kovah Date: Tue, 2 Jul 2019 14:55:07 +0200 Subject: [PATCH 4/4] Fix typo in Travic config --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3332923d..dafa0b3a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,6 +19,6 @@ jobs: - composer install - stage: test-frontend - language: nodejs + language: node_js node_js: - 'lts/*'