mirror of
https://github.com/github/semantic.git
synced 2024-12-22 22:31:36 +03:00
Remove test files
This commit is contained in:
parent
8bc4da76c9
commit
4e336520bc
43
test.A.js
43
test.A.js
@ -1,43 +0,0 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import $ from '../jquery'
|
|
||||||
import cast from '../typecast'
|
|
||||||
import {on} from 'delegated-events'
|
|
||||||
import {submit} from '../form'
|
|
||||||
|
|
||||||
let allowSubmit = false
|
|
||||||
|
|
||||||
function performHealthcheck() {
|
|
||||||
const repoName = cast(document.getElementById('showcase_item_name_with_owner'), HTMLInputElement).value
|
|
||||||
const submitButton = cast(document.getElementById('submit'), HTMLButtonElement)
|
|
||||||
const hiddenForm = cast(document.getElementsByClassName('js-submit-health-check')[0], HTMLFormElement)
|
|
||||||
const targetRepoName = cast(document.getElementById('repo_name'), HTMLInputElement)
|
|
||||||
document.getElementById("js-health").innerHTML = "Performing health check..."
|
|
||||||
targetRepoName.value = repoName
|
|
||||||
submitButton.disabled = false
|
|
||||||
allowSubmit = true
|
|
||||||
submit(hiddenForm)
|
|
||||||
}
|
|
||||||
|
|
||||||
function test() {
|
|
||||||
console.log("hi");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
on('submit', '#new_showcase_item', function(e) {
|
|
||||||
if (!allowSubmit) { e.preventDefault() }
|
|
||||||
})
|
|
||||||
|
|
||||||
$(document).on('ajaxSuccess', '.js-health', function(event, xhr, settings, data) {
|
|
||||||
this.innerHTML = data
|
|
||||||
})
|
|
||||||
|
|
||||||
on('focusout', '#showcase_item_name_with_owner', function() {
|
|
||||||
performHealthcheck()
|
|
||||||
})
|
|
||||||
|
|
||||||
on('focusin', '#showcase_item_body', function() {
|
|
||||||
if (cast(document.getElementById('showcase_item_name_with_owner'), HTMLInputElement).type === 'hidden') {
|
|
||||||
performHealthcheck()
|
|
||||||
}
|
|
||||||
})
|
|
49
test.B.js
49
test.B.js
@ -1,49 +0,0 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import cast from '../typecast'
|
|
||||||
import {changeValue} from '../form'
|
|
||||||
import {fetchSafeDocumentFragment} from '../fetch'
|
|
||||||
import {observe} from '../observe'
|
|
||||||
|
|
||||||
function performHealthCheck(container, repoName) {
|
|
||||||
const formCheck = cast(document.querySelector('.js-repo-health-check'), HTMLFormElement)
|
|
||||||
const nameToCheck = cast(formCheck.querySelector('.js-repo-health-name'), HTMLInputElement)
|
|
||||||
nameToCheck.value = repoName
|
|
||||||
|
|
||||||
const completedIndicator = cast(container.querySelector('.js-repo-health-check-completed'), HTMLInputElement)
|
|
||||||
changeValue(completedIndicator, '')
|
|
||||||
container.classList.remove('d-none')
|
|
||||||
container.classList.add('is-loading')
|
|
||||||
|
|
||||||
return fetchSafeDocumentFragment(document, formCheck.action, {
|
|
||||||
method: 'POST',
|
|
||||||
body: new FormData(formCheck),
|
|
||||||
}).then(html => {
|
|
||||||
const results = cast(container.querySelector('.js-repo-health-results'), HTMLElement)
|
|
||||||
results.innerHTML = ''
|
|
||||||
results.appendChild(html)
|
|
||||||
|
|
||||||
container.classList.remove('is-loading')
|
|
||||||
changeValue(completedIndicator, '1')
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function test() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
observe('.js-repo-health', function(container: HTMLElement) {
|
|
||||||
const form = cast(container.closest('form'), HTMLFormElement)
|
|
||||||
const repoInput = cast(form.querySelector('.js-repo-name'), HTMLInputElement)
|
|
||||||
|
|
||||||
if (repoInput.type === 'hidden') {
|
|
||||||
const description = cast(form.querySelector('.js-comment-field'), HTMLTextAreaElement)
|
|
||||||
description.addEventListener('focus', () => {
|
|
||||||
performHealthCheck(container, repoInput.value)
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
repoInput.addEventListener('change', () => {
|
|
||||||
performHealthCheck(container, repoInput.value)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
Loading…
Reference in New Issue
Block a user