lib.xp.examples.schema.createPage.js Maven / Gradle / Ivy
var schemaLib = require('/lib/xp/schema');
var assert = require('/lib/xp/testing');
/* global log*/
let resource = `
Virtual Page
My Page Description
`;
// BEGIN
// Create virtual page.
var result = schemaLib.createComponent({
key: 'myapp:mypage',
type: 'PAGE',
resource
});
log.info('Created page: ' + result.key);
// END
assert.assertJsonEquals({
key: 'myapp:mypage',
displayName: 'Virtual Page',
displayNameI18nKey: 'key.display-name',
description: 'My Page Description',
descriptionI18nKey: 'key.description',
componentPath: 'myapp:/site/pages/mypage',
modifiedTime: '2021-09-25T10:00:00Z',
resource: '\n' +
' \n' +
' Virtual Page \n' +
' My Page Description \n' +
' \n' +
' \n' +
' \n' +
' \n' +
' \n' +
' \n' +
' \n' +
' ',
type: 'PAGE',
form: [
{
'formItemType': 'Input',
'name': 'pause',
'label': 'Pause parameter',
'helpText': 'key1.help-text',
'maximize': true,
'inputType': 'Double',
'occurrences': {
'maximum': 1,
'minimum': 0
},
'config': {}
}
],
config: {},
regions: [
'header',
'main',
'footer'
]
}, result);