-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TINY-3199: Fixed an issue where clicking remove link, wasn't removing…
… the link in some cases
- Loading branch information
Showing
5 changed files
with
89 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import 'tinymce/themes/silver/Theme'; | ||
|
||
import { Assertions, Chain, Pipeline, Log } from '@ephox/agar'; | ||
import { UnitTest } from '@ephox/bedrock'; | ||
import { document } from '@ephox/dom-globals'; | ||
import { TinyApis, TinyDom, TinyLoader, TinyUi } from '@ephox/mcagar'; | ||
import { Element } from '@ephox/sugar'; | ||
import LinkPlugin from 'tinymce/plugins/link/Plugin'; | ||
|
||
UnitTest.asynctest('browser.tinymce.plugins.link.RemoveLinkTest', (success, failure) => { | ||
|
||
LinkPlugin(); | ||
|
||
TinyLoader.setup(function (editor, onSuccess, onFailure) { | ||
const tinyApis = TinyApis(editor); | ||
const tinyUi = TinyUi(editor); | ||
const doc = TinyDom.fromDom(document); | ||
const body = Element.fromDom(editor.getBody()); | ||
|
||
Pipeline.async({}, [ | ||
Log.stepsAsStep('TBA', 'Removing a link with a collapsed selection', [ | ||
tinyApis.sSetContent('<p><a href="http://tiny.cloud">tiny</a></p>'), | ||
tinyApis.sSetSelection([0, 0, 0], 2, [0, 0, 0], 2), | ||
Chain.asStep(doc, [ | ||
tinyUi.cTriggerContextMenu('open context menu', 'a[href="http://tiny.cloud"]', '.tox-silver-sink [role="menuitem"]') | ||
]), | ||
tinyUi.sClickOnUi('Click unlink', 'div[title="Remove link"]'), | ||
Assertions.sAssertPresence('Assert entire link removed', { 'a[href="http://tiny.cloud"]': 0 }, body), | ||
]), | ||
Log.stepsAsStep('TBA', 'Removing a link with some text selected', [ | ||
tinyApis.sSetContent('<p><a href="http://tiny.cloud">tiny</a></p>'), | ||
tinyApis.sSetSelection([0, 0, 0], 0, [0, 0, 0], 2), | ||
Chain.asStep(doc, [ | ||
tinyUi.cTriggerContextMenu('open context menu', 'a[href="http://tiny.cloud"]', '.tox-silver-sink [role="menuitem"]') | ||
]), | ||
tinyUi.sClickOnUi('Click unlink', 'div[title="Remove link"]'), | ||
Assertions.sAssertPresence('Assert entire link removed', { 'a[href="http://tiny.cloud"]': 0 }, body), | ||
]), | ||
Log.stepsAsStep('TBA', 'Removing a link from an image', [ | ||
tinyApis.sSetContent('<p><a href="http://tiny.cloud"><img src="http://moxiecode.cachefly.net/tinymce/v9/images/logo.png" /></a></p>'), | ||
tinyApis.sSetSelection([0, 0], 0, [0, 0], 1), | ||
Chain.asStep(doc, [ | ||
tinyUi.cTriggerContextMenu('open context menu', 'a[href="http://tiny.cloud"]', '.tox-silver-sink [role="menuitem"]') | ||
]), | ||
tinyUi.sClickOnUi('Click unlink', 'div[title="Remove link"]'), | ||
Assertions.sAssertPresence('Assert entire link removed', { 'a[href="http://tiny.cloud"]': 0 }, body), | ||
]) | ||
], onSuccess, onFailure); | ||
}, { | ||
plugins: 'link', | ||
toolbar: 'unlink', | ||
theme: 'silver', | ||
base_url: '/project/js/tinymce' | ||
}, success, failure); | ||
}); |