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,
|
||||
FEATURES: {
|
||||
extended_submission_state: true
|
||||
},
|
||||
TIMEZONE: 'America/Denver'
|
||||
}
|
||||
}
|
||||
|
||||
Enzyme.configure({adapter: new Adapter()})
|
||||
|
|
|
@ -197,7 +197,7 @@ RCE.propTypes = {
|
|||
// configurable default timeout value for flash alerts
|
||||
flashAlertTimeout: number,
|
||||
// user's timezone
|
||||
timezone: string.isRequired,
|
||||
timezone: string,
|
||||
// event handlers
|
||||
onFocus: func, // f(RCEWrapper component)
|
||||
onBlur: func, // f(event)
|
||||
|
|
|
@ -273,7 +273,7 @@ class RCEWrapper extends React.Component {
|
|||
use_rce_icon_maker: PropTypes.bool,
|
||||
features: PropTypes.objectOf(PropTypes.bool),
|
||||
flashAlertTimeout: PropTypes.number,
|
||||
timezone: PropTypes.string.isRequired
|
||||
timezone: PropTypes.string
|
||||
}
|
||||
|
||||
static defaultProps = {
|
||||
|
@ -283,7 +283,8 @@ class RCEWrapper extends React.Component {
|
|||
highContrastCSS: [],
|
||||
ltiTools: [],
|
||||
maxInitRenderedRCEs: -1,
|
||||
features: {}
|
||||
features: {},
|
||||
timezone: Intl?.DateTimeFormat()?.resolvedOptions()?.timeZone
|
||||
}
|
||||
|
||||
static skinCssInjected = false
|
||||
|
@ -375,8 +376,11 @@ class RCEWrapper extends React.Component {
|
|||
}
|
||||
|
||||
getRequiredFeatureStatuses() {
|
||||
const {new_equation_editor, new_math_equation_handling, rce_ux_improvements} =
|
||||
this.props.features
|
||||
const {
|
||||
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}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,15 +21,6 @@ import {render, waitFor} from '@testing-library/react'
|
|||
import RCE from '../RCE'
|
||||
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', () => {
|
||||
let target
|
||||
|
||||
|
@ -47,16 +38,13 @@ describe('RCE', () => {
|
|||
})
|
||||
|
||||
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'))
|
||||
})
|
||||
|
||||
it('supports getCode() and setCode() on its ref', async () => {
|
||||
const rceRef = createRef(null)
|
||||
render(
|
||||
<RCE ref={rceRef} textareaId="textarea3" defaultContent="Hello RCE!" {...requiredProps} />,
|
||||
target
|
||||
)
|
||||
render(<RCE ref={rceRef} textareaId="textarea3" defaultContent="Hello RCE!" />, target)
|
||||
|
||||
await waitFor(() => expect(rceRef.current).not.toBeNull())
|
||||
|
||||
|
|
|
@ -37,13 +37,7 @@ describe('RceModule', () => {
|
|||
editorOptions: () => {
|
||||
return {}
|
||||
},
|
||||
textareaId: 'textarea_id',
|
||||
features: {
|
||||
new_equation_editor: true,
|
||||
new_math_equation_handling: true,
|
||||
rce_ux_improvements: true
|
||||
},
|
||||
timezone: 'America/Denver'
|
||||
textareaId: 'textarea_id'
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -25,12 +25,6 @@ import {renderIntoDiv} from '../src'
|
|||
|
||||
renderIntoDiv(document.getElementById('content'), {
|
||||
textareaId: 'textarea',
|
||||
features: {
|
||||
new_equation_editor: true,
|
||||
new_math_equation_handling: true,
|
||||
rce_ux_improvements: true
|
||||
},
|
||||
timezone: 'America/Denver',
|
||||
editorOptions: () => {
|
||||
return {
|
||||
plugins: [
|
||||
|
|
|
@ -20,8 +20,6 @@ import React from 'react'
|
|||
import {render} from '@testing-library/react'
|
||||
import SearchResultsRow from '../SearchResultsRow'
|
||||
|
||||
window.ENV = {}
|
||||
|
||||
const item = {
|
||||
assignment: {
|
||||
anonymousGrading: false,
|
||||
|
|
|
@ -73,8 +73,7 @@ describe('OutcomeManagementPanel', () => {
|
|||
window.ENV = {
|
||||
PERMISSIONS: {
|
||||
manage_outcomes: true
|
||||
},
|
||||
TIMEZONE: 'America/Denver'
|
||||
}
|
||||
}
|
||||
|
||||
defaultMocks = [
|
||||
|
|
|
@ -168,7 +168,7 @@ CanvasRce.propTypes = {
|
|||
// configurable default timeout value for flash alerts
|
||||
flashAlertTimeout: number,
|
||||
// user's timezone
|
||||
timezone: string.isRequired,
|
||||
timezone: string,
|
||||
// event handlers
|
||||
onFocus: func, // f(RCEWrapper component) (sorry)
|
||||
onBlur: func, // f(event)
|
||||
|
|
Loading…
Reference in New Issue