- Implemented the PortalSettings Web Part with a new manifest and TypeScript file. - Created SCSS styles for the Web Part, defining various UI elements and responsive design. - Added localization support for English and German languages. - Developed tests for Provider Registry and static assets validation. - Included PowerShell script for project validation.
37 lines
1.8 KiB
JavaScript
37 lines
1.8 KiB
JavaScript
'use strict';
|
|
|
|
var fs = require('fs');
|
|
var path = require('path');
|
|
var root = path.resolve(__dirname, '..');
|
|
var passed = 0;
|
|
|
|
function read(file) { return fs.readFileSync(path.join(root, file), 'utf8'); }
|
|
function json(file) { return JSON.parse(read(file)); }
|
|
function assert(condition, message) { if (!condition) { throw new Error(message); } passed++; }
|
|
|
|
var packageJson = json('package.json');
|
|
var solution = json('config/package-solution.json').solution;
|
|
var config = json('config/config.json');
|
|
var manifest = json('src/webparts/portalSettings/PortalSettingsWebPart.manifest.json');
|
|
var styles = read('src/webparts/portalSettings/PortalSettings.scss');
|
|
var sourceFiles = [
|
|
'src/ui/Dom.ts',
|
|
'src/ui/DynamicFormRenderer.ts',
|
|
'src/ui/PortalSettingsApp.ts'
|
|
].map(read).join('\n');
|
|
|
|
assert(packageJson.version === '3.0.0', 'Package-Version ist nicht 3.0.0.');
|
|
assert(solution.version === '3.0.0.0', 'Solution-Version ist nicht 3.0.0.0.');
|
|
assert(!solution.features, 'Alte ASPX-Feature-Assets sind noch registriert.');
|
|
assert(!!config.bundles['portal-settings-web-part'], 'WebPart-Bundle fehlt.');
|
|
assert(manifest.componentType === 'WebPart', 'Komponente ist kein WebPart.');
|
|
assert(!fs.existsSync(path.join(root, 'src/assets/PortalSettings.aspx')), 'Alte ASPX-Seite ist noch vorhanden.');
|
|
assert(!fs.existsSync(path.join(root, 'src/extensions/portalSettings/PortalSettingsApplicationCustomizer.ts')), 'Alter Application Customizer ist noch vorhanden.');
|
|
assert(sourceFiles.indexOf('innerHTML') < 0, 'UI darf innerHTML nicht verwenden.');
|
|
['themePrimary', 'neutralPrimary', 'neutralLight', 'white'].forEach(function (slot) {
|
|
assert(styles.indexOf('[theme: ' + slot + ', default:') >= 0, 'Themeslot fehlt: ' + slot);
|
|
});
|
|
assert(packageJson.scripts.package.indexOf('npm test') === 0, 'Paketierung startet nicht mit Tests.');
|
|
|
|
console.log('PortalSettings static tests passed: ' + passed);
|