remove timezone prop requirement
also clean up unnecessary setup closes MAT-976 flag=none test plan: -specs pass Change-Id: I3774350af4a4087b269145c55ff1cc095f8b5b59 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/300013 Reviewed-by: Juan Chavez <juan.chavez@instructure.com> QA-Review: Joe Hernandez <joe.hernandez@instructure.com> Product-Review: Jake Oeding <jake.oeding@instructure.com> Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
This commit is contained in:
parent
72122ff5e5
commit
85f9c8c007
|
@ -146,8 +146,7 @@ window.ENV = {
|
||||||
use_rce_enhancements: true,
|
use_rce_enhancements: true,
|
||||||
FEATURES: {
|
FEATURES: {
|
||||||
extended_submission_state: true
|
extended_submission_state: true
|
||||||
},
|
}
|
||||||
TIMEZONE: 'America/Denver'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Enzyme.configure({adapter: new Adapter()})
|
Enzyme.configure({adapter: new Adapter()})
|
||||||
|
|
|
@ -197,7 +197,7 @@ RCE.propTypes = {
|
||||||
// configurable default timeout value for flash alerts
|
// configurable default timeout value for flash alerts
|
||||||
flashAlertTimeout: number,
|
flashAlertTimeout: number,
|
||||||
// user's timezone
|
// user's timezone
|
||||||
timezone: string.isRequired,
|
timezone: string,
|
||||||
// event handlers
|
// event handlers
|
||||||
onFocus: func, // f(RCEWrapper component)
|
onFocus: func, // f(RCEWrapper component)
|
||||||
onBlur: func, // f(event)
|
onBlur: func, // f(event)
|
||||||
|
|
|
@ -273,7 +273,7 @@ class RCEWrapper extends React.Component {
|
||||||
use_rce_icon_maker: PropTypes.bool,
|
use_rce_icon_maker: PropTypes.bool,
|
||||||
features: PropTypes.objectOf(PropTypes.bool),
|
features: PropTypes.objectOf(PropTypes.bool),
|
||||||
flashAlertTimeout: PropTypes.number,
|
flashAlertTimeout: PropTypes.number,
|
||||||
timezone: PropTypes.string.isRequired
|
timezone: PropTypes.string
|
||||||
}
|
}
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
|
@ -283,7 +283,8 @@ class RCEWrapper extends React.Component {
|
||||||
highContrastCSS: [],
|
highContrastCSS: [],
|
||||||
ltiTools: [],
|
ltiTools: [],
|
||||||
maxInitRenderedRCEs: -1,
|
maxInitRenderedRCEs: -1,
|
||||||
features: {}
|
features: {},
|
||||||
|
timezone: Intl?.DateTimeFormat()?.resolvedOptions()?.timeZone
|
||||||
}
|
}
|
||||||
|
|
||||||
static skinCssInjected = false
|
static skinCssInjected = false
|
||||||
|
@ -375,8 +376,11 @@ class RCEWrapper extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
getRequiredFeatureStatuses() {
|
getRequiredFeatureStatuses() {
|
||||||
const {new_equation_editor, new_math_equation_handling, rce_ux_improvements} =
|
const {
|
||||||
this.props.features
|
new_equation_editor = false,
|
||||||
|
new_math_equation_handling = false,
|
||||||
|
rce_ux_improvements = false
|
||||||
|
} = this.props.features
|
||||||
return {new_equation_editor, new_math_equation_handling, rce_ux_improvements}
|
return {new_equation_editor, new_math_equation_handling, rce_ux_improvements}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,15 +21,6 @@ import {render, waitFor} from '@testing-library/react'
|
||||||
import RCE from '../RCE'
|
import RCE from '../RCE'
|
||||||
import bridge from '../../bridge'
|
import bridge from '../../bridge'
|
||||||
|
|
||||||
const requiredProps = {
|
|
||||||
features: {
|
|
||||||
new_equation_editor: true,
|
|
||||||
new_math_equation_handling: true,
|
|
||||||
rce_ux_improvements: true
|
|
||||||
},
|
|
||||||
timezone: 'America/Denver'
|
|
||||||
}
|
|
||||||
|
|
||||||
describe('RCE', () => {
|
describe('RCE', () => {
|
||||||
let target
|
let target
|
||||||
|
|
||||||
|
@ -47,16 +38,13 @@ describe('RCE', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('bridges newly rendered editors', async () => {
|
it('bridges newly rendered editors', async () => {
|
||||||
render(<RCE textareaId="textarea3" {...requiredProps} />, target)
|
render(<RCE textareaId="textarea3" />, target)
|
||||||
await waitFor(() => expect(bridge.activeEditor().constructor.displayName).toEqual('RCEWrapper'))
|
await waitFor(() => expect(bridge.activeEditor().constructor.displayName).toEqual('RCEWrapper'))
|
||||||
})
|
})
|
||||||
|
|
||||||
it('supports getCode() and setCode() on its ref', async () => {
|
it('supports getCode() and setCode() on its ref', async () => {
|
||||||
const rceRef = createRef(null)
|
const rceRef = createRef(null)
|
||||||
render(
|
render(<RCE ref={rceRef} textareaId="textarea3" defaultContent="Hello RCE!" />, target)
|
||||||
<RCE ref={rceRef} textareaId="textarea3" defaultContent="Hello RCE!" {...requiredProps} />,
|
|
||||||
target
|
|
||||||
)
|
|
||||||
|
|
||||||
await waitFor(() => expect(rceRef.current).not.toBeNull())
|
await waitFor(() => expect(rceRef.current).not.toBeNull())
|
||||||
|
|
||||||
|
|
|
@ -37,13 +37,7 @@ describe('RceModule', () => {
|
||||||
editorOptions: () => {
|
editorOptions: () => {
|
||||||
return {}
|
return {}
|
||||||
},
|
},
|
||||||
textareaId: 'textarea_id',
|
textareaId: 'textarea_id'
|
||||||
features: {
|
|
||||||
new_equation_editor: true,
|
|
||||||
new_math_equation_handling: true,
|
|
||||||
rce_ux_improvements: true
|
|
||||||
},
|
|
||||||
timezone: 'America/Denver'
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -25,12 +25,6 @@ import {renderIntoDiv} from '../src'
|
||||||
|
|
||||||
renderIntoDiv(document.getElementById('content'), {
|
renderIntoDiv(document.getElementById('content'), {
|
||||||
textareaId: 'textarea',
|
textareaId: 'textarea',
|
||||||
features: {
|
|
||||||
new_equation_editor: true,
|
|
||||||
new_math_equation_handling: true,
|
|
||||||
rce_ux_improvements: true
|
|
||||||
},
|
|
||||||
timezone: 'America/Denver',
|
|
||||||
editorOptions: () => {
|
editorOptions: () => {
|
||||||
return {
|
return {
|
||||||
plugins: [
|
plugins: [
|
||||||
|
|
|
@ -20,8 +20,6 @@ import React from 'react'
|
||||||
import {render} from '@testing-library/react'
|
import {render} from '@testing-library/react'
|
||||||
import SearchResultsRow from '../SearchResultsRow'
|
import SearchResultsRow from '../SearchResultsRow'
|
||||||
|
|
||||||
window.ENV = {}
|
|
||||||
|
|
||||||
const item = {
|
const item = {
|
||||||
assignment: {
|
assignment: {
|
||||||
anonymousGrading: false,
|
anonymousGrading: false,
|
||||||
|
|
|
@ -73,8 +73,7 @@ describe('OutcomeManagementPanel', () => {
|
||||||
window.ENV = {
|
window.ENV = {
|
||||||
PERMISSIONS: {
|
PERMISSIONS: {
|
||||||
manage_outcomes: true
|
manage_outcomes: true
|
||||||
},
|
}
|
||||||
TIMEZONE: 'America/Denver'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultMocks = [
|
defaultMocks = [
|
||||||
|
|
|
@ -168,7 +168,7 @@ CanvasRce.propTypes = {
|
||||||
// configurable default timeout value for flash alerts
|
// configurable default timeout value for flash alerts
|
||||||
flashAlertTimeout: number,
|
flashAlertTimeout: number,
|
||||||
// user's timezone
|
// user's timezone
|
||||||
timezone: string.isRequired,
|
timezone: string,
|
||||||
// event handlers
|
// event handlers
|
||||||
onFocus: func, // f(RCEWrapper component) (sorry)
|
onFocus: func, // f(RCEWrapper component) (sorry)
|
||||||
onBlur: func, // f(event)
|
onBlur: func, // f(event)
|
||||||
|
|
Loading…
Reference in New Issue