diff --git a/includes/article.html b/includes/article.html
index 30d3f67b8f..86ed5636d5 100644
--- a/includes/article.html
+++ b/includes/article.html
@@ -55,11 +55,6 @@
{% endfor %}
{% endif %}
-
- {% assign helpId = 'xl' %}
- {% include helpfulness %}
- {% include contribution %}
-
- {% assign helpId = 'sm' %}
+
{% include helpfulness %}
{% include contribution %}
diff --git a/includes/helpfulness.html b/includes/helpfulness.html
index b4d8a04d5b..ccbea5746d 100644
--- a/includes/helpfulness.html
+++ b/includes/helpfulness.html
@@ -1,5 +1,5 @@
{% unless enterpriseServerReleases.isOldestReleaseDeprecated and currentVersion contains enterpriseServerReleases.oldestSupported %}
-
-{% endunless %}
\ No newline at end of file
+{% endunless %}
diff --git a/javascripts/experiment.js b/javascripts/experiment.js
index ba501f52d9..200e718455 100644
--- a/javascripts/experiment.js
+++ b/javascripts/experiment.js
@@ -41,28 +41,4 @@ export default function () {
// const xbucket = bucket(testName)
// if (xbucket === TREATMENT) { ... }
// x.addEventListener('click', () => { sendSuccess(testName) })
-
- const testName = 'helpfulness-prompt-to-bottom'
- const xbucket = bucket(testName)
-
- if (xbucket === TREATMENT) {
- const bigHelpfulness = document.querySelector('#helpfulness-xl')
- const smallHelpfulness = document.querySelector('#helpfulness-sm')
-
- // Check that helpfulness prompt is present on this page
- if (!(bigHelpfulness && smallHelpfulness)) {
- return
- }
-
- // Remove the -xl prompts
- bigHelpfulness.parentElement.parentElement.removeChild(bigHelpfulness.parentElement)
-
- // Always show the -sm prompt
- smallHelpfulness.parentElement.classList.remove('d-xl-none')
- }
-
- const votes = Array.from(document.querySelectorAll('.js-helpfulness [type=radio]'))
- votes.forEach(voteEl => {
- voteEl.addEventListener('change', () => { sendSuccess(testName) })
- })
}
diff --git a/javascripts/helpfulness.js b/javascripts/helpfulness.js
index 01d95ebf51..f5bc95ee72 100644
--- a/javascripts/helpfulness.js
+++ b/javascripts/helpfulness.js
@@ -1,17 +1,15 @@
import { sendEvent } from './events'
export default function helpfulness () {
- const forms = Array.from(document.querySelectorAll('.js-helpfulness'))
+ const form = document.querySelector('.js-helpfulness')
const texts = Array.from(document.querySelectorAll('.js-helpfulness input, .js-helpfulness textarea'))
const votes = Array.from(document.querySelectorAll('.js-helpfulness [type=radio]'))
- if (!forms.length || !texts.length || !votes.length) return
+ if (!form || !texts.length || !votes.length) return
- forms.forEach(form => {
- form.addEventListener('submit', async evt => {
- evt.preventDefault()
- await submitForm(evt.target)
- updateDisplay(form, 'end')
- })
+ form.addEventListener('submit', async evt => {
+ evt.preventDefault()
+ await submitForm(evt.target)
+ updateDisplay(form, 'end')
})
votes.forEach(voteEl => {
diff --git a/tests/browser/browser.js b/tests/browser/browser.js
index 1d99bd64e9..f050f4e6a4 100644
--- a/tests/browser/browser.js
+++ b/tests/browser/browser.js
@@ -134,20 +134,20 @@ describe('helpfulness', () => {
})
// When I click the "Yes" button
- await page.click('#helpfulness-sm [for=helpfulness-yes-sm]')
+ await page.click('.js-helpfulness [for=helpfulness-yes]')
// (sent a POST request to /events)
// I see the request for my email
- await page.waitForSelector('#helpfulness-sm [type="email"]')
+ await page.waitForSelector('.js-helpfulness [type="email"]')
// When I fill in my email and submit the form
- await page.type('#helpfulness-sm [type="email"]', 'test@example.com')
+ await page.type('.js-helpfulness [type="email"]', 'test@example.com')
await sleep(1000)
- await page.click('#helpfulness-sm [type="submit"]')
+ await page.click('.js-helpfulness [type="submit"]')
// (sent a PUT request to /events/{id})
// I see the feedback
- await page.waitForSelector('#helpfulness-sm [data-help-end]')
+ await page.waitForSelector('.js-helpfulness [data-help-end]')
})
})