Make default link text the link title
the placeholder text should always be the current link's title and saving with no text entered should default to the current link's title closes LF-343 flag=rce_ux_improvements test plan: - have an rce open with the flag on, add a course link to your page. - open the course link options tray. Change the text to something else, remove the text, and ensure the placeholder is still the title of the current link - change the current link to a different course link using the tray - delete the text and ensure placeholder is the new link - click replace and make sure the text is the new link's title Change-Id: I99e0600600732f59670911520688dd5f4a9913c5 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/319776 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Reviewed-by: Jackson Howe <jackson.howe@instructure.com> QA-Review: Jackson Howe <jackson.howe@instructure.com> Product-Review: Sarah Gerard <sarah.gerard@instructure.com>
This commit is contained in:
parent
1e5cd64e06
commit
eef78e1646
|
@ -289,7 +289,7 @@ export default function CanvasContentTray(props) {
|
|||
published,
|
||||
})
|
||||
setLinkText(text)
|
||||
setPlaceholderText(text)
|
||||
setPlaceholderText(fileName)
|
||||
} else {
|
||||
setIsEditTray(false)
|
||||
}
|
||||
|
@ -371,7 +371,7 @@ export default function CanvasContentTray(props) {
|
|||
const newLink = {
|
||||
...link,
|
||||
forceRename: true,
|
||||
text: linkText || placeholderText,
|
||||
text: linkText,
|
||||
}
|
||||
|
||||
bridge.insertLink(newLink)
|
||||
|
@ -490,7 +490,7 @@ export default function CanvasContentTray(props) {
|
|||
<LinkDisplay
|
||||
linkText={linkText}
|
||||
Icon={Icon}
|
||||
placeholderText={placeholderText}
|
||||
placeholderText={link?.title || placeholderText}
|
||||
linkFileName={link?.title || ''}
|
||||
published={link?.published || false}
|
||||
handleTextChange={setLinkText}
|
||||
|
|
|
@ -24,6 +24,7 @@ import * as fakeSource from '../../../../rcs/fake'
|
|||
import initialState from '../../../../sidebar/store/initialState'
|
||||
import sidebarHandlers from '../../../../sidebar/containers/sidebarHandlers'
|
||||
import CanvasContentTray from '../CanvasContentTray'
|
||||
import {LinkDisplay} from '../LinkDisplay'
|
||||
|
||||
jest.useFakeTimers()
|
||||
jest.mock('../../../../canvasFileBrowser/FileBrowser', () => {
|
||||
|
@ -43,6 +44,9 @@ jest.mock('../../../../bridge', () => {
|
|||
original.default.insertLink = jest.fn()
|
||||
return original
|
||||
})
|
||||
jest.mock('../LinkDisplay', () => ({
|
||||
LinkDisplay: jest.fn(() => <div data-testid="LinkDisplay" />),
|
||||
}))
|
||||
|
||||
const storeInitialState = {
|
||||
...initialState({
|
||||
|
@ -148,6 +152,17 @@ describe('RCE Plugins > CanvasContentTray', () => {
|
|||
})
|
||||
})
|
||||
})
|
||||
|
||||
it('sets placeholder to the current link title', async () => {
|
||||
renderComponent()
|
||||
await showTrayForPlugin('course_link_edit')
|
||||
await waitFor(() => {
|
||||
expect(LinkDisplay).toHaveBeenCalledWith(
|
||||
expect.objectContaining({placeholderText: 'some filename'}),
|
||||
{}
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('Tray Label in course context', () => {
|
||||
|
|
Loading…
Reference in New Issue