-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into use-npm-ci
- Loading branch information
Showing
15 changed files
with
213 additions
and
139 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import {test, expect} from '@playwright/test'; | ||
import {Monitoring} from './page-object-models/monitoring'; | ||
import {restoreDatabaseSnapshot, s} from './utils'; | ||
import {TreeSelectDriver} from './utils/tree-select-driver'; | ||
|
||
test.describe('sending an article', async () => { | ||
test('sending an article to another desk', async ({page}) => { | ||
const monitoring = new Monitoring(page); | ||
|
||
await restoreDatabaseSnapshot(); | ||
await page.goto('/#/workspace/monitoring'); | ||
await monitoring.selectDeskOrWorkspace('Sports'); | ||
|
||
await monitoring.executeActionOnMonitoringItem( | ||
page.locator(s('monitoring-group=Sports / Working Stage', 'article-item=story 2')), | ||
'Edit', | ||
); | ||
|
||
await page.locator(s('authoring-topbar', 'open-send-publish-pane')).click(); | ||
await page.locator(s('interactive-actions-panel', 'tabs')).getByRole('tab', {name: 'Send to'}).click(); | ||
|
||
// selecting other desk | ||
await new TreeSelectDriver( | ||
page, | ||
page.locator(s('destination-select')), | ||
).setValue(['Educations']); | ||
await page | ||
.locator(s('interactive-actions-panel', 'stage-select')) | ||
.getByRole('radio', {name: 'Working Stage'}) | ||
.check(); | ||
await page.locator(s('interactive-actions-panel', 'send')).click(); | ||
|
||
await expect( | ||
page.locator(s('monitoring-group=Sports / Working Stage', 'article-item=story 2')), | ||
).not.toBeVisible(); | ||
await monitoring.selectDeskOrWorkspace('Educations'); | ||
await expect( | ||
page.locator(s('monitoring-group=Educations / Working Stage', 'article-item=story 2')), | ||
).toBeVisible(); | ||
}); | ||
|
||
test('sending an article to another stage', async ({page}) => { | ||
const monitoring = new Monitoring(page); | ||
|
||
await restoreDatabaseSnapshot(); | ||
await page.goto('/#/workspace/monitoring'); | ||
await monitoring.selectDeskOrWorkspace('Sports'); | ||
|
||
await monitoring.executeActionOnMonitoringItem( | ||
page.locator(s('monitoring-group=Sports / Working Stage', 'article-item=story 2')), | ||
'Edit', | ||
); | ||
|
||
await page.locator(s('authoring-topbar', 'open-send-publish-pane')).click(); | ||
await page.locator(s('interactive-actions-panel', 'tabs')).getByRole('tab', {name: 'Send to'}).click(); | ||
|
||
// selecting other stage | ||
await page | ||
.locator(s('interactive-actions-panel', 'stage-select')) | ||
.getByRole('radio', {name: 'Incoming Stage'}) | ||
.check(); | ||
await page.locator(s('interactive-actions-panel', 'send')).click(); | ||
|
||
await expect( | ||
page.locator(s('monitoring-group=Sports / Working Stage', 'article-item=story 2')), | ||
).not.toBeVisible(); | ||
await expect( | ||
page.locator(s('monitoring-group=Sports / Incoming Stage', 'article-item=story 2')), | ||
).toBeVisible(); | ||
}); | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,13 +1,41 @@ | ||
import {sdApi} from 'api'; | ||
import React from 'react'; | ||
|
||
interface IProps { | ||
value: string; | ||
} | ||
|
||
export function adjustHTMLForPreview(html: string): string { | ||
const parsed: HTMLElement = | ||
new DOMParser().parseFromString(html, 'text/html').body; | ||
|
||
parsed.querySelectorAll('[data-custom-block-type]').forEach((element) => { | ||
const customBlockType = element.getAttribute('data-custom-block-type'); | ||
const vocabulary = sdApi.vocabularies.getAll().get(customBlockType); | ||
const separator = '<div style="border-top: 2px solid lightgray; margin-top: 10px; margin-bottom: 10px;"></div>'; | ||
|
||
element.innerHTML = `<div> | ||
${separator} | ||
<div class="mb-1 mt-0-5"> | ||
<span class="label label--translucent">${vocabulary.display_name}</span> | ||
</div> | ||
${element.innerHTML} | ||
${separator} | ||
</div>`; | ||
}); | ||
|
||
return parsed.innerHTML; | ||
} | ||
|
||
export class HtmlPreview extends React.Component<IProps> { | ||
render() { | ||
const html = this.props.value; | ||
|
||
return ( | ||
<div dangerouslySetInnerHTML={{__html: this.props.value}} /> | ||
<div dangerouslySetInnerHTML={{__html: adjustHTMLForPreview(html)}} /> | ||
); | ||
} | ||
} |
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
Oops, something went wrong.