import { describe, it, before, after } from '@ephox/bedrock-client'; import { TinyHooks, TinySelections, TinyUiActions } from '@ephox/wrap-mcagar'; import Editor from 'tinymce/core/api/Editor'; import Plugin from 'tinymce/plugins/link/Plugin'; import { TestLinkUi } from '../module/TestLinkUi'; describe('browser.tinymce.plugins.link.SelectedImageFigureTest', () => { const hook = TinyHooks.bddSetupLight({ plugins: 'link image', toolbar: 'link', base_url: '/project/tinymce/js/tinymce' }, [ Plugin ]); before(() => { TestLinkUi.clearHistory(); }); after(() => { TestLinkUi.clearHistory(); }); it('TINY-8832: link button should NOT be highlighted when there is no link in a figure element', async () => { const editor = hook.editor(); editor.setContent(` `); await TinyUiActions.pWaitForUi(editor, '[title="Insert/edit link"]:not(.tox-tbtn--enabled)'); TinySelections.select(editor, 'figure.has-link', []); await TinyUiActions.pWaitForUi(editor, '[title="Insert/edit link"].tox-tbtn--enabled'); TinySelections.select(editor, 'figure.no-link', []); await TinyUiActions.pWaitForUi(editor, '[title="Insert/edit link"]:not(.tox-tbtn--enabled)'); }); });