govuk_publishing_components 28.6.0 → 28.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 85985bab4532c5cbccfa05369e032e61cedfda7468ab5654d10ce0eb937155b8
4
- data.tar.gz: fd00b4c1e0784b1951f0103412dc7dd2eaf619d2ad72456c77b892903fc1cd9a
3
+ metadata.gz: 3ebad3c8838bc6fe453b4dbf3274f3289885e17c4ab87456140663f68ab48fbb
4
+ data.tar.gz: 3a74ffb39a677727ac02521fb63549c7dd62f995c67b20555f0e07a9b89c2da3
5
5
  SHA512:
6
- metadata.gz: fd73aa7768ba4224e03065bb8b04becf3e4c227c50422eb5255ab52fe82a075a8e5968d143ecb80bbc3f3481432783ab1ef7dad55515801f2905c2449676989d
7
- data.tar.gz: 6b0541c15147aedcbbd890cb222d280ba02f492fb84d5a280580b5fa6d64a58f6e5a80ae2277bd9667e3e9c7a9c28b22ba2ef590400b5b047230cb3e0036f41b
6
+ metadata.gz: f50da8d0de71594b12f61e96b030dd956e5cfe6e71cd12ffdd02365720d3a33b1c981633415f805d09c357fddf69e90bb853662256c2ef21bcdab4b1497a24e0
7
+ data.tar.gz: 8320ccc0808090c48328b117d18c6241341ebdb50c84e157868386992278d41d431c9a2a853f22330b07e6df6f0871cd73172cb1f8d7f5a71542c9a1b0ff820e
data/README.md CHANGED
@@ -29,10 +29,10 @@ To run JavaScript tests (only):
29
29
 
30
30
  ```sh
31
31
  # run JS tests in browser
32
- bin/rake app:jasmine
32
+ yarn run jasmine:browser
33
33
 
34
34
  # run JS tests on command line
35
- bin/rake app:jasmine:ci
35
+ yarn run jasmine:ci
36
36
  ```
37
37
 
38
38
  ### Further documentation
@@ -87,22 +87,23 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
87
87
  var params = new FormData($form)
88
88
  params = new URLSearchParams(params).toString()
89
89
 
90
- xhr.open('POST', url, true)
91
- xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded')
92
-
93
- xhr.onreadystatechange = function () {
94
- if (xhr.readyState === 4 && xhr.status === 200) {
90
+ this.done = function () {
91
+ if (xhr.status === 200) {
95
92
  this.trackEvent(this.getTrackEventParams($form))
96
93
  this.showFormSuccess(xhr.message)
97
94
  this.revealInitialPrompt()
98
95
  this.setInitialAriaAttributes()
99
- this.activeForm.hidden ? this.activeForm.hidden = false : this.activeForm.hidden = true
96
+ this.activeForm.hidden = true
100
97
  } else {
101
98
  this.showError(xhr)
102
99
  this.enableSubmitFormButton($form)
103
100
  }
104
101
  }.bind(this)
105
102
 
103
+ xhr.addEventListener('loadend', this.done)
104
+ xhr.open('POST', url, true)
105
+ xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded')
106
+
106
107
  this.disableSubmitFormButton($form)
107
108
  xhr.send(params)
108
109
  }.bind(this))