test(12.1-05): unit tests for the list, form, preview and routing behaviours of Phase 12.1 in the SPA
- list: the bulk menu in the toolbar and on the list view with its three failure rows, row states and invisible columns in the table - form: the forbidden banner, password and preset on the form view, locked relation options, the save body of password and permission fields - preview view: context fields, hidden tabs, the status hint, the footer with zero, one and several actions, load failures - routing: the preview route and mapWinterUrl - backstops: focus returns to the bulk menu trigger; preview URL mapping and the route replacement; locked relation options - the slug preset runs on the table the user plugin's slug test uses
This commit is contained in:
@@ -7,6 +7,8 @@ import SwitchField from '../../src/components/form/fields/SwitchField.vue'
|
||||
import TextField from '../../src/components/form/fields/TextField.vue'
|
||||
import TextareaField from '../../src/components/form/fields/TextareaField.vue'
|
||||
import PartialField from '../../src/components/form/fields/PartialField.vue'
|
||||
import PasswordField from '../../src/components/form/fields/PasswordField.vue'
|
||||
import PermissionEditorField from '../../src/components/form/fields/PermissionEditorField.vue'
|
||||
import UnsupportedField from '../../src/components/form/fields/UnsupportedField.vue'
|
||||
import WidgetField from '../../src/components/form/fields/WidgetField.vue'
|
||||
import RelationManager from '../../src/components/relation/RelationManager.vue'
|
||||
@@ -148,3 +150,30 @@ describe('control module', () => {
|
||||
expect(toggleValue).toBe(control.toggleValue)
|
||||
})
|
||||
})
|
||||
|
||||
describe('Phase 12.1 field types (UI-SPEC S5 and S7)', () => {
|
||||
it('registers password and permissioneditor as editable types with their own controls', () => {
|
||||
expect(rendererFor('password')).toBe(PasswordField)
|
||||
expect(rendererFor('permissioneditor')).toBe(PermissionEditorField)
|
||||
expect(isRegistered('password')).toBe(true)
|
||||
expect(isRegistered('permissioneditor')).toBe(true)
|
||||
// Both hold a form value: they are part of the save body.
|
||||
expect(needsRecord('password')).toBe(false)
|
||||
expect(needsRecord('permissioneditor')).toBe(false)
|
||||
})
|
||||
|
||||
it('labels a password as an input and a permission editor as a group', () => {
|
||||
expect(ownsLabel('password')).toBe(false)
|
||||
expect(ownsLabel('permissioneditor')).toBe(false)
|
||||
expect(groupLabelled('password')).toBe(false)
|
||||
expect(groupLabelled('permissioneditor')).toBe(true)
|
||||
})
|
||||
|
||||
it('still answers the unsupported control for a type it does not know', () => {
|
||||
for (const type of ['passwordeditor', 'Password', 'permission', '']) {
|
||||
expect(isRegistered(type), type).toBe(false)
|
||||
expect(rendererFor(type), type).not.toBe(PasswordField)
|
||||
expect(rendererFor(type), type).not.toBe(PermissionEditorField)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user