Skip to content

Commit 151bf2a

Browse files
authored
repo sync
2 parents 3f491e5 + bcd91a0 commit 151bf2a

4 files changed

Lines changed: 4 additions & 85 deletions

File tree

javascripts/experiment.js

Lines changed: 1 addition & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import murmur from 'imurmurhash'
22
import { getUserEventsId, sendEvent } from './events'
3-
import h from './hyperscript'
4-
5-
import { updateDisplay, submitForm } from './helpfulness'
3+
// import h from './hyperscript'
64

75
const TREATMENT = 'TREATMENT'
86
const CONTROL = 'CONTROL'
@@ -29,79 +27,4 @@ export default function () {
2927
// const x = document.querySelector(...)
3028
// x.addEventListener('click', () => { sendSuccess(testName) })
3129
// if (xbucket === TREATMENT) applyTreatment(x)
32-
33-
const testName = 'survey-stars'
34-
const xbucket = bucket(testName)
35-
36-
const form = document.querySelector('.js-helpfulness')
37-
if (!form) return
38-
39-
// Overwrites the default handler for helpfulness survey...
40-
form.addEventListener('submit', evt => {
41-
evt.preventDefault()
42-
sendSuccess(testName)
43-
submitForm(form)
44-
updateDisplay(form, 'end')
45-
})
46-
47-
if (xbucket === TREATMENT) applyTreatment(form)
48-
}
49-
50-
function applyTreatment (form) {
51-
const p = form.querySelector('.radio-group')
52-
p.innerHTML = ''
53-
54-
const buttons = [1, 2, 3, 4, 5].map(i =>
55-
h(
56-
'button',
57-
{
58-
'data-value': i,
59-
'aria-label': i,
60-
class: 'btn-link tooltipped tooltipped-n'
61-
},
62-
h(
63-
'span',
64-
{
65-
class: 'star-empty f3'
66-
},
67-
'☆'
68-
),
69-
h(
70-
'span',
71-
{
72-
class: 'star-full f3',
73-
hidden: true
74-
},
75-
'★'
76-
)
77-
)
78-
)
79-
const input = h('input', {
80-
name: 'helpfulness-vote',
81-
type: 'hidden'
82-
})
83-
buttons.forEach(btn => p.appendChild(btn))
84-
p.appendChild(input)
85-
86-
buttons.forEach((btn, i) => {
87-
btn.addEventListener('click', evt => {
88-
evt.preventDefault()
89-
updateBtnDisplay(i)
90-
submitForm(form)
91-
updateDisplay(form, i > 2 ? 'yes' : 'no')
92-
})
93-
})
94-
95-
function updateBtnDisplay (i) {
96-
buttons.forEach((xbtn, xi) => {
97-
if (xi <= i) {
98-
xbtn.querySelector('.star-full').removeAttribute('hidden')
99-
xbtn.querySelector('.star-empty').setAttribute('hidden', true)
100-
} else {
101-
xbtn.querySelector('.star-full').setAttribute('hidden', true)
102-
xbtn.querySelector('.star-empty').removeAttribute('hidden')
103-
}
104-
})
105-
input.setAttribute('value', i > 2 ? 'Yes' : 'No')
106-
}
10730
}

javascripts/helpfulness.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function hideElement (el) {
88
el.setAttribute('hidden', true)
99
}
1010

11-
export function updateDisplay (form, state) {
11+
function updateDisplay (form, state) {
1212
Array.from(
1313
form.querySelectorAll(
1414
['start', 'yes', 'no', 'end']
@@ -21,7 +21,7 @@ export function updateDisplay (form, state) {
2121
.forEach(showElement)
2222
}
2323

24-
export function submitForm (form) {
24+
function submitForm (form) {
2525
const formData = new FormData(form)
2626
const data = Object.fromEntries(
2727
Array.from(formData.entries())

lib/redirects/get-old-paths-from-permalink.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@ module.exports = function getOldPathsFromPath (currentPath, languageCode, curren
5353
.replace('/user/', '/'))
5454
}
5555

56-
// create old path /enterprise/foo from current path /enterprise/latest/user/foo
57-
oldPaths.add(currentPath
58-
.replace(`/enterprise/${latest}/user/`, '/enterprise/'))
59-
6056
// ------ END LEGACY VERSION FORMAT REPLACEMENTS ------//
6157

6258
// ------ BEGIN MODERN VERSION FORMAT REPLACEMENTS ------//

tests/browser/browser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ describe('browser search', () => {
8585
})
8686
})
8787

88-
describe.skip('helpfulness', () => {
88+
describe('helpfulness', () => {
8989
it('sends an event to /events when submitting form', async () => {
9090
// Visit a page that displays the prompt
9191
await page.goto('http://localhost:4001/en/actions/getting-started-with-github-actions/about-github-actions')

0 commit comments

Comments
 (0)