fix more specs relying on babel ie11 transpilation
Change-Id: I8141f30b9da5ba2a91791f02e4755d5df13a0ea1 Reviewed-on: https://gerrit.instructure.com/203949 Tested-by: Jenkins Reviewed-by: Steven Burnett <sburnett@instructure.com> QA-Review: Steven Burnett <sburnett@instructure.com> Product-Review: Ryan Shaw <ryan@instructure.com>
This commit is contained in:
parent
0ddb2f5e62
commit
0da4de9d32
|
@ -152,10 +152,11 @@ QUnit.module('GradebookSettingsModal', suiteHooks => {
|
|||
.returns(updateCourseSettingsPromise.promise)
|
||||
})
|
||||
|
||||
suiteHooks.afterEach(async () => {
|
||||
await ensureModalIsClosed()
|
||||
ReactDOM.unmountComponentAtNode($container)
|
||||
$container.remove()
|
||||
suiteHooks.afterEach(() => {
|
||||
return ensureModalIsClosed().then(() => {
|
||||
ReactDOM.unmountComponentAtNode($container)
|
||||
$container.remove()
|
||||
})
|
||||
})
|
||||
|
||||
function mountComponent() {
|
||||
|
@ -439,11 +440,12 @@ QUnit.module('GradebookSettingsModal', suiteHooks => {
|
|||
})
|
||||
|
||||
QUnit.module('when a late policy change is invalid', contextHooks => {
|
||||
contextHooks.beforeEach(async () => {
|
||||
await mountOpenAndLoad()
|
||||
getAutomaticallyApplyMissingCheckbox().click()
|
||||
const $input = getModalElement().querySelector('#missing-submission-grade')
|
||||
fireEvent.change($input, {target: {value: '-1'}})
|
||||
contextHooks.beforeEach(() => {
|
||||
return mountOpenAndLoad().then(() => {
|
||||
getAutomaticallyApplyMissingCheckbox().click()
|
||||
const $input = getModalElement().querySelector('#missing-submission-grade')
|
||||
fireEvent.change($input, {target: {value: '-1'}})
|
||||
})
|
||||
})
|
||||
|
||||
test('does not attempt to create the late policy', () => {
|
||||
|
@ -469,12 +471,13 @@ QUnit.module('GradebookSettingsModal', suiteHooks => {
|
|||
})
|
||||
|
||||
QUnit.module('when creating a new late policy', hooks => {
|
||||
hooks.beforeEach(async () => {
|
||||
hooks.beforeEach(() => {
|
||||
sandbox.spy(FlashAlert, 'showFlashAlert')
|
||||
|
||||
await mountOpenAndLoad()
|
||||
getAutomaticallyApplyMissingCheckbox().click()
|
||||
getUpdateButton().click()
|
||||
return mountOpenAndLoad().then(() => {
|
||||
getAutomaticallyApplyMissingCheckbox().click()
|
||||
getUpdateButton().click()
|
||||
})
|
||||
})
|
||||
|
||||
hooks.afterEach(() => {
|
||||
|
@ -487,9 +490,9 @@ QUnit.module('GradebookSettingsModal', suiteHooks => {
|
|||
})
|
||||
|
||||
QUnit.module('when the request succeeds', contextHooks => {
|
||||
contextHooks.beforeEach(async () => {
|
||||
contextHooks.beforeEach(() => {
|
||||
createLatePolicyPromise.resolve()
|
||||
await waitForModalClosed()
|
||||
return waitForModalClosed()
|
||||
})
|
||||
|
||||
test('displays a flash alert', () => {
|
||||
|
@ -507,9 +510,9 @@ QUnit.module('GradebookSettingsModal', suiteHooks => {
|
|||
})
|
||||
|
||||
QUnit.module('when the request fails', contextHooks => {
|
||||
contextHooks.beforeEach(async () => {
|
||||
contextHooks.beforeEach(() => {
|
||||
createLatePolicyPromise.reject(new Error('request failed'))
|
||||
await wait(() => FlashAlert.showFlashAlert.callCount > 0)
|
||||
return wait(() => FlashAlert.showFlashAlert.callCount > 0)
|
||||
})
|
||||
|
||||
test('displays a flash alert', () => {
|
||||
|
@ -528,13 +531,14 @@ QUnit.module('GradebookSettingsModal', suiteHooks => {
|
|||
})
|
||||
|
||||
QUnit.module('when updating the late policy', hooks => {
|
||||
hooks.beforeEach(async () => {
|
||||
hooks.beforeEach(() => {
|
||||
sandbox.spy(FlashAlert, 'showFlashAlert')
|
||||
|
||||
fetchedLatePolicy = existingLatePolicy
|
||||
await mountOpenAndLoad()
|
||||
getAutomaticallyApplyMissingCheckbox().click()
|
||||
getUpdateButton().click()
|
||||
return mountOpenAndLoad().then(() => {
|
||||
getAutomaticallyApplyMissingCheckbox().click()
|
||||
getUpdateButton().click()
|
||||
})
|
||||
})
|
||||
|
||||
hooks.afterEach(() => {
|
||||
|
@ -547,9 +551,9 @@ QUnit.module('GradebookSettingsModal', suiteHooks => {
|
|||
})
|
||||
|
||||
QUnit.module('when the request succeeds', contextHooks => {
|
||||
contextHooks.beforeEach(async () => {
|
||||
contextHooks.beforeEach(() => {
|
||||
updateLatePolicyPromise.resolve()
|
||||
await waitForModalClosed()
|
||||
return waitForModalClosed()
|
||||
})
|
||||
|
||||
test('displays a flash alert', () => {
|
||||
|
@ -567,9 +571,9 @@ QUnit.module('GradebookSettingsModal', suiteHooks => {
|
|||
})
|
||||
|
||||
QUnit.module('when the request fails', contextHooks => {
|
||||
contextHooks.beforeEach(async () => {
|
||||
contextHooks.beforeEach(() => {
|
||||
updateLatePolicyPromise.reject(new Error('request failed'))
|
||||
await wait(() => FlashAlert.showFlashAlert.callCount > 0)
|
||||
return wait(() => FlashAlert.showFlashAlert.callCount > 0)
|
||||
})
|
||||
|
||||
test('displays a flash alert', () => {
|
||||
|
@ -588,14 +592,15 @@ QUnit.module('GradebookSettingsModal', suiteHooks => {
|
|||
})
|
||||
|
||||
QUnit.module('when updating the course post policy', hooks => {
|
||||
hooks.beforeEach(async () => {
|
||||
hooks.beforeEach(() => {
|
||||
sandbox.spy(FlashAlert, 'showFlashAlert')
|
||||
sandbox.spy(props.postPolicies, 'setCoursePostPolicy')
|
||||
sandbox.spy(props.postPolicies, 'setAssignmentPostPolicies')
|
||||
|
||||
await mountOpenLoadAndSelectTab('Grade Posting Policy')
|
||||
getManuallyPostGradesOption().click()
|
||||
getUpdateButton().click()
|
||||
return mountOpenLoadAndSelectTab('Grade Posting Policy').then(() => {
|
||||
getManuallyPostGradesOption().click()
|
||||
getUpdateButton().click()
|
||||
})
|
||||
})
|
||||
|
||||
hooks.afterEach(() => {
|
||||
|
@ -621,9 +626,9 @@ QUnit.module('GradebookSettingsModal', suiteHooks => {
|
|||
})
|
||||
|
||||
QUnit.module('when getAssignmentPostPolicies succeeds', assignmentSuccessHooks => {
|
||||
assignmentSuccessHooks.beforeEach(async () => {
|
||||
assignmentSuccessHooks.beforeEach(() => {
|
||||
getAssignmentPostPoliciesPromise.resolve()
|
||||
await waitForModalClosed()
|
||||
return waitForModalClosed()
|
||||
})
|
||||
|
||||
test('displays a flash alert', async () => {
|
||||
|
@ -661,9 +666,9 @@ QUnit.module('GradebookSettingsModal', suiteHooks => {
|
|||
})
|
||||
|
||||
QUnit.module('when getAssignmentPostPolicies fails', assignmentFailureHooks => {
|
||||
assignmentFailureHooks.beforeEach(async () => {
|
||||
assignmentFailureHooks.beforeEach(() => {
|
||||
getAssignmentPostPoliciesPromise.reject()
|
||||
await wait(() => FlashAlert.showFlashAlert.callCount > 0)
|
||||
return wait(() => FlashAlert.showFlashAlert.callCount > 0)
|
||||
})
|
||||
|
||||
test('shows an "error" flash alert', () => {
|
||||
|
@ -674,9 +679,9 @@ QUnit.module('GradebookSettingsModal', suiteHooks => {
|
|||
})
|
||||
|
||||
QUnit.module('when the request fails', contextHooks => {
|
||||
contextHooks.beforeEach(async () => {
|
||||
contextHooks.beforeEach(() => {
|
||||
setCoursePostPolicyPromise.reject(new Error('request failed'))
|
||||
await wait(() => FlashAlert.showFlashAlert.callCount > 0)
|
||||
return wait(() => FlashAlert.showFlashAlert.callCount > 0)
|
||||
})
|
||||
|
||||
test('displays a flash alert', () => {
|
||||
|
@ -699,12 +704,13 @@ QUnit.module('GradebookSettingsModal', suiteHooks => {
|
|||
})
|
||||
|
||||
QUnit.module('when updating advanced settings', hooks => {
|
||||
hooks.beforeEach(async () => {
|
||||
hooks.beforeEach(() => {
|
||||
sandbox.spy(FlashAlert, 'showFlashAlert')
|
||||
|
||||
await mountOpenLoadAndSelectTab('Advanced')
|
||||
getAllowFinalGradeOverrideCheckbox().click()
|
||||
getUpdateButton().click()
|
||||
return mountOpenLoadAndSelectTab('Advanced').then(() => {
|
||||
getAllowFinalGradeOverrideCheckbox().click()
|
||||
getUpdateButton().click()
|
||||
})
|
||||
})
|
||||
|
||||
hooks.afterEach(() => {
|
||||
|
@ -717,9 +723,9 @@ QUnit.module('GradebookSettingsModal', suiteHooks => {
|
|||
})
|
||||
|
||||
QUnit.module('when the request succeeds', contextHooks => {
|
||||
contextHooks.beforeEach(async () => {
|
||||
contextHooks.beforeEach(() => {
|
||||
updateCourseSettingsPromise.resolve()
|
||||
await waitForModalClosed()
|
||||
return waitForModalClosed()
|
||||
})
|
||||
|
||||
test('displays a flash alert', () => {
|
||||
|
@ -746,9 +752,9 @@ QUnit.module('GradebookSettingsModal', suiteHooks => {
|
|||
})
|
||||
|
||||
QUnit.module('when the request fails', contextHooks => {
|
||||
contextHooks.beforeEach(async () => {
|
||||
contextHooks.beforeEach(() => {
|
||||
updateCourseSettingsPromise.reject(new Error('request failed'))
|
||||
await wait(() => FlashAlert.showFlashAlert.callCount > 0)
|
||||
return wait(() => FlashAlert.showFlashAlert.callCount > 0)
|
||||
})
|
||||
|
||||
test('displays a flash alert', () => {
|
||||
|
|
|
@ -24,8 +24,8 @@ import $ from 'jquery'
|
|||
import ConditionalRelease from 'jsx/shared/conditional_release/ConditionalRelease'
|
||||
|
||||
let editor = null
|
||||
window.conditional_release_module = {
|
||||
ConditionalReleaseEditor: env => {
|
||||
class ConditionalReleaseEditor {
|
||||
constructor(env) {
|
||||
editor = {
|
||||
attach: sinon.stub(),
|
||||
updateAssignment: sinon.stub(),
|
||||
|
@ -37,6 +37,7 @@ window.conditional_release_module = {
|
|||
return editor
|
||||
}
|
||||
}
|
||||
window.conditional_release_module = {ConditionalReleaseEditor}
|
||||
|
||||
let component = null
|
||||
const createComponent = submitCallback => {
|
||||
|
|
|
@ -92,16 +92,17 @@ QUnit.module('AssessmentAuditTray Api', suiteHooks => {
|
|||
let tool
|
||||
let quiz
|
||||
|
||||
contextHooks.beforeEach(async () => {
|
||||
contextHooks.beforeEach(() => {
|
||||
server
|
||||
.for(url)
|
||||
.respond({status: 200, body: {audit_events: auditEvents, users, tools, quizzes}})
|
||||
|
||||
const returnData = await loadAssessmentAuditTrail()
|
||||
event = returnData.auditEvents[0]
|
||||
user = returnData.users[0]
|
||||
tool = returnData.externalTools[0]
|
||||
quiz = returnData.quizzes[0]
|
||||
return loadAssessmentAuditTrail().then(returnData => {
|
||||
event = returnData.auditEvents[0]
|
||||
user = returnData.users[0]
|
||||
tool = returnData.externalTools[0]
|
||||
quiz = returnData.quizzes[0]
|
||||
})
|
||||
})
|
||||
|
||||
QUnit.module('returned event data', () => {
|
||||
|
|
Loading…
Reference in New Issue