diff --git a/frontend/src/app/components/modals/editor/editor-macros.service.ts b/frontend/src/app/components/modals/editor/editor-macros.service.ts index eb321bb3ea..a93fdc2241 100644 --- a/frontend/src/app/components/modals/editor/editor-macros.service.ts +++ b/frontend/src/app/components/modals/editor/editor-macros.service.ts @@ -61,7 +61,8 @@ export class EditorMacrosService { */ public configureWikiPageInclude(page:string):Promise { return new Promise((resolve, _) => { - const modal = this.opModalService.show(WikiIncludePageMacroModal, { page: page }); + const pageValue = page || ''; + const modal = this.opModalService.show(WikiIncludePageMacroModal, { page: pageValue }); modal.closingEvent.subscribe((modal:WikiIncludePageMacroModal) => { if (modal.changed) { resolve(modal.page); diff --git a/spec/features/wysiwyg/macros/child_pages_spec.rb b/spec/features/wysiwyg/macros/child_pages_spec.rb index 30d257ebc3..89029e24a6 100644 --- a/spec/features/wysiwyg/macros/child_pages_spec.rb +++ b/spec/features/wysiwyg/macros/child_pages_spec.rb @@ -94,6 +94,10 @@ describe 'Wysiwyg child pages spec', # Find widget, click to show toolbar placeholder = find('.macro.-child_pages') + # Placeholder states `this page` and no `Include parent` + expect(placeholder).to have_text('this page') + expect(placeholder).not_to have_text('Include parent') + # Edit widget and cancel again placeholder.click page.find('.ck-balloon-panel .ck-button', visible: :all, text: 'Edit').click @@ -110,6 +114,9 @@ describe 'Wysiwyg child pages spec', # Save widget find('.op-modal--submit-button').click + # Placeholder states `parent-page` and no `Include parent` + expect(placeholder).to have_text('parent-page') + expect(placeholder).not_to have_text('Include parent') end # Save wiki page @@ -126,7 +133,7 @@ describe 'Wysiwyg child pages spec', find('.toolbar .icon-edit').click end - editor.in_editor do |container, editable| + editor.in_editor do |_container, _editable| # Find widget, click to show toolbar placeholder = find('.macro.-child_pages') @@ -138,6 +145,10 @@ describe 'Wysiwyg child pages spec', # Save widget find('.op-modal--submit-button').click + + # Placeholder states `parent-page` and `Include parent` + expect(placeholder).to have_text('parent-page') + expect(placeholder).to have_text('Include parent') end # Save wiki page diff --git a/spec/features/wysiwyg/macros/include_wiki_page_spec.rb b/spec/features/wysiwyg/macros/include_wiki_page_spec.rb index 2570ca0997..29972a66c5 100644 --- a/spec/features/wysiwyg/macros/include_wiki_page_spec.rb +++ b/spec/features/wysiwyg/macros/include_wiki_page_spec.rb @@ -96,10 +96,13 @@ describe 'Wysiwyg include wiki page spec', find('.op-modal--submit-button').click # Find widget, click to show toolbar - modal = find('.macro.-wiki_page_include') + placeholder = find('.macro.-wiki_page_include') + + # Placeholder states `included` + expect(placeholder).to have_text('included') # Edit widget again - modal.click + placeholder.click page.find('.ck-balloon-panel .ck-button', visible: :all, text: 'Edit').click expect(page).to have_field('selected-page', with: 'included') find('.op-modal--cancel-button').click