fix wrong link url in rce link plugin
closes CORE-1018 test plan: - go to an rce - create two lines of text - select the first line - click the link button in the toolbar and make it a link - select the second line - click the link button in the toolbar - it should not be prepopulated with the previous link's url Change-Id: Iba4e72a3f58bc0372afb71034d520285837973bc Reviewed-on: https://gerrit.instructure.com/141322 Reviewed-by: Clay Diffrient <cdiffrient@instructure.com> QA-Review: Tucker McKnight <tmcknight@instructure.com> Reviewed-by: Ryan Shaw <ryan@instructure.com> Tested-by: Jenkins Product-Review: Brent Burgoyne <bburgoyne@instructure.com>
This commit is contained in:
parent
4915ae31b9
commit
3feb8ef79e
|
@ -321,6 +321,8 @@ import YouTubeApi from './youtube_api'
|
|||
$box.find(".disable_inline_content").attr('checked', $a.hasClass('inline_disabled')).triggerHandler('change');
|
||||
$box.find(".auto_show_inline_content").attr('checked', $a.hasClass('auto_open')).triggerHandler('change');
|
||||
$box.find(".insert_button").text("Update Link");
|
||||
} else {
|
||||
$box.find(".prompt").val('').change();
|
||||
}
|
||||
$box.dialog({
|
||||
width: 425,
|
||||
|
|
|
@ -182,3 +182,44 @@ test('it adds in inline_disabled if checked', () => {
|
|||
const classes = EditorLinks.buildLinkClasses(priorClasses, box)
|
||||
equal(classes, ' inline_disabled')
|
||||
})
|
||||
|
||||
let renderDialog_ed = null
|
||||
|
||||
QUnit.module("InstructureLinks Tinymce Plugin: renderDialog", {
|
||||
setup() {
|
||||
renderDialog_ed = {
|
||||
getBody: () => null,
|
||||
nodeChanged: () => null,
|
||||
selection: {
|
||||
getContent: () => null,
|
||||
getNode: () => ({nodeName: 'SPAN'})
|
||||
}
|
||||
};
|
||||
},
|
||||
teardown() {
|
||||
$("#instructure_link_prompt").remove()
|
||||
}
|
||||
})
|
||||
|
||||
test("it resets the text field if no existing link is selected", () => {
|
||||
EditorLinks.renderDialog(renderDialog_ed)
|
||||
const $prompt = $("#instructure_link_prompt .prompt")
|
||||
const $btn = $("#instructure_link_prompt .btn")
|
||||
$prompt.val("someurl")
|
||||
$btn.click()
|
||||
EditorLinks.renderDialog(renderDialog_ed)
|
||||
equal($prompt.val(), "")
|
||||
})
|
||||
|
||||
test("it sets the text field to the href if link is selected", () => {
|
||||
EditorLinks.renderDialog(renderDialog_ed)
|
||||
const $prompt = $("#instructure_link_prompt .prompt")
|
||||
const $btn = $("#instructure_link_prompt .btn")
|
||||
$prompt.val("otherurl")
|
||||
$btn.click()
|
||||
const a = document.createElement('a')
|
||||
a.href = 'linkurl'
|
||||
renderDialog_ed.selection.getNode = () => a
|
||||
EditorLinks.renderDialog(renderDialog_ed)
|
||||
equal($prompt.val(), "linkurl")
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue