-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import {test} from '@playwright/test'; | ||
import {restoreDatabaseSnapshot, s} from './utils'; | ||
|
||
test('creation and persistance of a custom block', async ({page}) => { | ||
await restoreDatabaseSnapshot(); | ||
await page.goto('/#/settings/vocabularies'); | ||
await page.getByRole('button', {name: 'Custom blocks'}).click(); | ||
This comment has been minimized.
Sorry, something went wrong. |
||
await page.getByRole('button', {name: 'Add New'}).click(); | ||
|
||
// Input sample data | ||
await page.locator(s('vocabulary-edit-content', 'vocabulary-edit--id')).fill('test_vocabulary'); | ||
This comment has been minimized.
Sorry, something went wrong. |
||
await page.locator(s('vocabulary-edit-content', 'vocabulary-edit-field--name')).fill('test_vocabulary'); | ||
This comment has been minimized.
Sorry, something went wrong. |
||
await page.locator(s('vocabulary-edit-content', 'editor3')).getByRole('textbox').fill('test data'); | ||
|
||
// Add formatting options to template editor | ||
await page.locator(s('vocabulary-edit-content', 'open-popover')).click(); | ||
This comment has been minimized.
Sorry, something went wrong. |
||
await page.locator(s('tree-select-popover')).getByRole('button', {name: 'h2'}).click(); | ||
await page.locator(s('editor3')).getByText('test data').click(); | ||
|
||
// Apply formatting option to sample text data | ||
await page.locator(s('editor3', 'formatting-option=H2')).click(); | ||
|
||
await page.locator(s('vocabulary-edit-footer')).getByRole('button', {name: 'Save'}).click(); | ||
|
||
// Edit custom block | ||
await page.locator(s('vocabulary-item=test_vocabulary')).hover().then(async () => { | ||
This comment has been minimized.
Sorry, something went wrong.
tomaskikutis
Member
|
||
await page.locator(s('vocabulary-item=test_vocabulary', 'vocabulary-item--start-editing')).click(); | ||
|
||
// Remove formatting option | ||
await page.locator(s('editor3', 'formatting-option=H2')).click(); | ||
await page.locator(s('vocabulary-edit-footer')).getByRole('button', {name: 'Save'}).click(); | ||
}); | ||
This comment has been minimized.
Sorry, something went wrong.
tomaskikutis
Member
|
||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ <h3 class="modal__heading" ng-show="vocabulary._id"><span translate>Edit</span> | |
<h3 class="modal__heading" ng-show="!vocabulary._id"><span translate>Create</span></h3> | ||
<a href="" class="icn-btn close-modal" ng-click="cancel()"><i class="icon-close-small"></i></a> | ||
</div> | ||
<div class="modal__body modal__body--with-navigation"> | ||
<div class="modal__body modal__body--with-navigation" data-test-id="vocabulary-edit-content"> | ||
<ul class="modal__navigation" ng-if="matchFieldTypeToTab('vocabularies', vocabulary.field_type)"> | ||
<li ng-class="{'active': tab === 'general'}"> | ||
<button ng-click="setTab('general')" translate>General</button> | ||
|
@@ -27,8 +27,16 @@ <h3 class="modal__heading" ng-show="!vocabulary._id"><span translate>Create</spa | |
ng-class="{'sd-line-input--invalid': issues._id, 'sd-line-input--required': !vocabulary._id}" | ||
ng-if="!vocabulary._links || !matchFieldTypeToTab('vocabularies', vocabulary.field_type)"> | ||
<label for="cv_id" class="sd-line-input__label" translate>ID</label> | ||
<input id="cv_id" class="sd-line-input__input" type="text" ng-model="vocabulary._id" | ||
ng-pattern="idRegex" ng-readonly="!!vocabulary._links" required> | ||
<input | ||
id="cv_id" | ||
class="sd-line-input__input" | ||
type="text" | ||
ng-model="vocabulary._id" | ||
ng-pattern="idRegex" | ||
ng-readonly="!!vocabulary._links" | ||
required | ||
data-test-id="vocabulary-edit--id" | ||
This comment has been minimized.
Sorry, something went wrong.
tomaskikutis
Member
|
||
> | ||
<div class="sd-line-input__message" ng-show="issues._id.unique || issues._id.deleted" | ||
translate>ID must be unique.</div> | ||
<div class="sd-line-input__message" ng-show="issues._id.conflict" translate>ID conflicts | ||
|
@@ -309,7 +317,7 @@ <h3 class="modal__heading" ng-show="!vocabulary._id"><span translate>Create</spa | |
</div> | ||
</div> | ||
|
||
<div class="modal__footer"> | ||
<div class="modal__footer" data-test-id="vocabulary-edit-footer"> | ||
<div class="button-group button-group--end button-group--comfort" role="group"> | ||
<button | ||
id="cancel-edit-btn" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,7 +91,16 @@ export default class StyleButton extends React.Component<IPropsStyleButton> { | |
onMouseDown={this.onToggle} | ||
style={this.props.uiTheme == null ? undefined : {color: this.props.uiTheme.textColor}} | ||
> | ||
{iconClass ? <i className={iconClass} /> : <b>{label}</b>} | ||
{iconClass | ||
This comment has been minimized.
Sorry, something went wrong.
tomaskikutis
Member
|
||
? ( | ||
<i | ||
data-test-id="formatting-option" | ||
data-test-value={styleTooltips[label]} | ||
className={iconClass} | ||
/> | ||
) | ||
: <b>{label}</b> | ||
} | ||
</span> | ||
); | ||
} | ||
|
namespace it here so it's