@ui5/create-webcomponents-package 0.0.0-e5b03d3e8 → 0.0.0-ebd9a4db3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +88 -0
- package/README.md +6 -8
- package/create-package.js +193 -156
- package/package.json +3 -1
- package/template/.eslintignore +3 -1
- package/template/cypress/component/MyFirstComponent.cy.tsx +13 -0
- package/template/cypress/fixtures/example.json +5 -0
- package/template/cypress/support/commands.ts +37 -0
- package/template/cypress/support/component-index.html +12 -0
- package/template/cypress/support/component.ts +36 -0
- package/template/cypress/tsconfig.template.json +19 -0
- package/template/cypress.config.ts +10 -0
- package/template/env +1 -0
- package/template/gitignore +2 -1
- package/template/package.json +35 -0
- package/template/src/Assets.ts +1 -1
- package/template/src/MyFirstComponent.ts +11 -11
- package/template/src/MyFirstComponentTemplate.tsx +2 -2
- package/template/{bundle.esm.js → src/bundle.esm.ts} +4 -3
- package/template/test/pages/css/index.css +62 -14
- package/template/test/pages/index.html +36 -40
- package/template/{tsconfig.json → tsconfig.template.json} +2 -1
- package/template/config/wdio.conf.cjs +0 -1
- package/template/src/themes/sap_fiori_3/parameters-bundle.css +0 -3
- package/template/test/specs/Demo.spec.js +0 -13
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,94 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
# [2.11.0-rc.1](https://github.com/SAP/ui5-webcomponents/compare/v2.11.0-rc.0...v2.11.0-rc.1) (2025-05-15)
|
7
|
+
|
8
|
+
**Note:** Version bump only for package @ui5/create-webcomponents-package
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
# [2.11.0-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v2.10.0...v2.11.0-rc.0) (2025-05-08)
|
15
|
+
|
16
|
+
**Note:** Version bump only for package @ui5/create-webcomponents-package
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
# [2.10.0](https://github.com/SAP/ui5-webcomponents/compare/v2.10.0-rc.3...v2.10.0) (2025-05-07)
|
23
|
+
|
24
|
+
**Note:** Version bump only for package @ui5/create-webcomponents-package
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
# [2.10.0-rc.3](https://github.com/SAP/ui5-webcomponents/compare/v2.10.0-rc.2...v2.10.0-rc.3) (2025-05-01)
|
31
|
+
|
32
|
+
**Note:** Version bump only for package @ui5/create-webcomponents-package
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
# [2.10.0-rc.2](https://github.com/SAP/ui5-webcomponents/compare/v2.10.0-rc.1...v2.10.0-rc.2) (2025-04-24)
|
39
|
+
|
40
|
+
**Note:** Version bump only for package @ui5/create-webcomponents-package
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
# [2.10.0-rc.1](https://github.com/SAP/ui5-webcomponents/compare/v2.10.0-rc.0...v2.10.0-rc.1) (2025-04-17)
|
47
|
+
|
48
|
+
**Note:** Version bump only for package @ui5/create-webcomponents-package
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
# [2.10.0-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v2.9.1-rc.0...v2.10.0-rc.0) (2025-04-14)
|
55
|
+
|
56
|
+
**Note:** Version bump only for package @ui5/create-webcomponents-package
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
## [2.9.1-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v2.9.0...v2.9.1-rc.0) (2025-04-10)
|
63
|
+
|
64
|
+
**Note:** Version bump only for package @ui5/create-webcomponents-package
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
# [2.9.0](https://github.com/SAP/ui5-webcomponents/compare/v2.9.0-rc.3...v2.9.0) (2025-04-04)
|
71
|
+
|
72
|
+
**Note:** Version bump only for package @ui5/create-webcomponents-package
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
# [2.9.0-rc.3](https://github.com/SAP/ui5-webcomponents/compare/v2.9.0-rc.2...v2.9.0-rc.3) (2025-04-03)
|
79
|
+
|
80
|
+
**Note:** Version bump only for package @ui5/create-webcomponents-package
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
# [2.9.0-rc.2](https://github.com/SAP/ui5-webcomponents/compare/v2.9.0-rc.1...v2.9.0-rc.2) (2025-03-27)
|
87
|
+
|
88
|
+
**Note:** Version bump only for package @ui5/create-webcomponents-package
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
6
94
|
# [2.9.0-rc.1](https://github.com/SAP/ui5-webcomponents/compare/v2.9.0-rc.0...v2.9.0-rc.1) (2025-03-20)
|
7
95
|
|
8
96
|
**Note:** Version bump only for package @ui5/create-webcomponents-package
|
package/README.md
CHANGED
@@ -15,10 +15,9 @@ Usage:
|
|
15
15
|
npm init @ui5/webcomponents-package -- [OPTIONS]
|
16
16
|
|
17
17
|
Options:
|
18
|
-
--name <string>
|
19
|
-
--
|
20
|
-
--
|
21
|
-
--skip - skips configuration and generates package with a default value for each parameter that wasn't passed
|
18
|
+
--name <string> - defines the package name
|
19
|
+
--test-setup <"cypress" | "manual"> - defines whether the predefined test setup should be added or it will be configured manually.
|
20
|
+
--skip - skips configuration and generates package with a default value for each parameter that wasn't passed
|
22
21
|
```
|
23
22
|
|
24
23
|
The script creates a new directory, and fills it with a `package.json` file and all necessary source files, and resources for a new
|
@@ -30,10 +29,9 @@ components package.
|
|
30
29
|
Usage:
|
31
30
|
yarn create @ui5/webcomponents-package [OPTIONS]
|
32
31
|
Options:
|
33
|
-
--name <string>
|
34
|
-
--
|
35
|
-
--
|
36
|
-
--skip - skips configuration and generates package with a default value for each parameter that wasn't passed
|
32
|
+
--name <string> - defines the package name
|
33
|
+
--test-setup <"cypress" | "manual"> - defines whether the predefined test setup should be added or it will be configured manually.
|
34
|
+
--skip - skips configuration and generates package with a default value for each parameter that wasn't passed
|
37
35
|
```
|
38
36
|
|
39
37
|
The script creates a new directory, and fills it with a `package.json` file and all necessary source files, and resources for a new
|
package/create-package.js
CHANGED
@@ -1,191 +1,216 @@
|
|
1
1
|
#!/usr/bin/env node
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
2
|
+
import fs from "fs/promises";
|
3
|
+
import path, { dirname } from "path";
|
4
|
+
import prompts from "prompts";
|
5
|
+
import parser from "npm-config-user-agent-parser";
|
6
|
+
import yargs from "yargs/yargs";
|
7
|
+
import { hideBin } from "yargs/helpers";
|
8
|
+
import { fileURLToPath } from "url";
|
9
|
+
import * as prettier from "prettier";
|
10
|
+
|
11
|
+
const __filename = fileURLToPath(import.meta.url);
|
12
|
+
const __dirname = dirname(__filename);
|
11
13
|
const argv = yargs(hideBin(process.argv)).argv;
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
const
|
19
|
-
|
20
|
-
|
21
|
-
const
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
14
|
+
const VERSION = JSON.parse(
|
15
|
+
await fs.readFile(path.join(__dirname, "package.json")),
|
16
|
+
).version;
|
17
|
+
|
18
|
+
// Constants
|
19
|
+
const SUPPORTED_TEST_SETUPS = ["cypress", "manual"];
|
20
|
+
const SRC_DIR = path.join(__dirname, "template");
|
21
|
+
const DEST_DIR = process.cwd();
|
22
|
+
|
23
|
+
const FILES_TO_RENAME = {
|
24
|
+
"eslintignore": ".eslintignore",
|
25
|
+
"eslintrc.cjs": ".eslintrc.cjs",
|
26
|
+
"npsrc.json": ".npsrc.json",
|
27
|
+
"npmrc": ".npmrc",
|
28
|
+
"env": ".env",
|
29
|
+
"gitignore": ".gitignore",
|
30
|
+
"tsconfig.template.json": "tsconfig.json",
|
31
|
+
"cypress/tsconfig.template.json": "cypress/tsconfig.json"
|
26
32
|
};
|
33
|
+
const FILES_TO_COPY = ["test/pages/img/logo.png"];
|
34
|
+
|
35
|
+
// Validation Patterns
|
36
|
+
const PackageNamePattern =
|
37
|
+
/^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/;
|
38
|
+
const TagPattern = /^[a-z0-9]+?-[a-zA-Z0-9\-_]+?[a-z0-9]$/;
|
39
|
+
|
40
|
+
// Utility Functions
|
41
|
+
const isPackageNameValid = name =>
|
42
|
+
typeof name === "string" && PackageNamePattern.test(name);
|
43
|
+
const isTagValid = tag => typeof tag === "string" && TagPattern.test(tag);
|
44
|
+
const isTestSetupValid = setup =>
|
45
|
+
typeof setup === "string" && SUPPORTED_TEST_SETUPS.includes(setup);
|
46
|
+
|
47
|
+
async function collectFiles(dir, fileList = []) {
|
48
|
+
const entries = await fs.readdir(dir, { withFileTypes: true });
|
49
|
+
|
50
|
+
for (const entry of entries) {
|
51
|
+
const fullPath = path.join(dir, entry.name);
|
52
|
+
if (entry.isDirectory()) {
|
53
|
+
await collectFiles(fullPath, fileList);
|
54
|
+
} else if (entry.isFile()) {
|
55
|
+
fileList.push(fullPath);
|
56
|
+
}
|
57
|
+
}
|
27
58
|
|
28
|
-
|
29
|
-
|
30
|
-
const isPackageNameValid = name => typeof name === "string" && name.match(/^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/);
|
31
|
-
const isComponentNameValid = name => typeof name === "string" && ComponentNamePattern.test(name);
|
32
|
-
const isTagValid = tag => typeof tag === "string" && tag.match(/^[a-z0-9]+?-[a-zA-Z0-9\-_]+?[a-z0-9]$/);
|
59
|
+
return fileList;
|
60
|
+
}
|
33
61
|
|
34
62
|
/**
|
35
63
|
* Hyphanates the given PascalCase string, f.e.:
|
36
64
|
* Foo -> "my-foo" (adds preffix)
|
37
65
|
* FooBar -> "foo-bar"
|
38
66
|
*/
|
39
|
-
const
|
40
|
-
const result = componentName
|
41
|
-
|
67
|
+
const hyphenateComponentName = componentName => {
|
68
|
+
const result = componentName
|
69
|
+
.replace(/([a-z])([A-Z])/g, "$1-$2")
|
70
|
+
.toLowerCase();
|
42
71
|
return result.includes("-") ? result : `my-${result}`;
|
43
72
|
};
|
44
73
|
|
45
|
-
|
46
|
-
|
47
|
-
for (let key in vars) {
|
48
|
-
const re = new RegExp(key, "g");
|
49
|
-
content = content.replace(re, vars[key]);
|
50
|
-
}
|
51
|
-
return content;
|
52
|
-
};
|
53
|
-
|
54
|
-
const replaceVarsInFileName = (vars, fileName) => {
|
55
|
-
return fileName.replace(/MyFirstComponent/, vars.INIT_PACKAGE_VAR_CLASS_NAME);
|
56
|
-
};
|
57
|
-
|
58
|
-
const copyFile = (vars, sourcePath, destPath) => {
|
59
|
-
if (isLogo(sourcePath)) {
|
60
|
-
fs.copyFileSync(sourcePath, destPath);
|
61
|
-
return;
|
62
|
-
}
|
63
|
-
|
64
|
-
let content = fs.readFileSync(sourcePath, { encoding: "UTF-8" });
|
65
|
-
content = replaceVarsInFileContent(vars, content);
|
66
|
-
destPath = replaceVarsInFileName(vars, destPath);
|
67
|
-
|
68
|
-
fs.writeFileSync(destPath, content);
|
69
|
-
|
70
|
-
// Rename "gitignore" to ".gitignore" (npm init won't include ".gitignore", so we add it as "gitignore" and rename it later)
|
71
|
-
if (isGitIgnore(sourcePath)) {
|
72
|
-
fs.renameSync(destPath, destPath.replace("gitignore", ".gitignore"))
|
73
|
-
}
|
74
|
-
|
75
|
-
// Rename "npmrc" to ".npmrc" (npm init won't include ".npmrc", so we add it as "npmrc" and rename it later)
|
76
|
-
if (isNPMRC(sourcePath)) {
|
77
|
-
fs.renameSync(destPath, destPath.replace("npmrc", ".npmrc"));
|
78
|
-
}
|
79
|
-
};
|
74
|
+
const replacePlaceholders = (content, replacements) =>
|
75
|
+
content.replace(/{{(.*?)}}/g, (_, key) => replacements[key.trim()] || "");
|
80
76
|
|
81
|
-
const
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
copyFiles(vars, path.join(sourcePath, file), path.join(destPath, file));
|
89
|
-
});
|
90
|
-
} else {
|
91
|
-
copyFile(vars, sourcePath, destPath);
|
92
|
-
}
|
93
|
-
};
|
94
|
-
|
95
|
-
const generateFilesContent = (packageName, componentName, skipSubfolder) => {
|
96
|
-
const tagName = argv.tag || hyphaneteComponentName(componentName);
|
97
|
-
|
98
|
-
// All variables that will be replaced in the content of the resources/
|
77
|
+
const generateFilesContent = async (
|
78
|
+
packageName,
|
79
|
+
componentName,
|
80
|
+
skipSubfolder,
|
81
|
+
testSetup,
|
82
|
+
) => {
|
83
|
+
// All variables that will be replaced in the content of the template folder/
|
99
84
|
const vars = {
|
100
85
|
INIT_PACKAGE_VAR_NAME: packageName,
|
101
|
-
|
86
|
+
INIT_PACKAGE_VERSION: VERSION,
|
87
|
+
INIT_PACKAGE_VAR_TAG: argv.tag || hyphenateComponentName(componentName),
|
102
88
|
INIT_PACKAGE_VAR_CLASS_NAME: componentName,
|
89
|
+
INIT_PACKAGE_CYPRESS_ROOT_TSCONFIG:
|
90
|
+
testSetup === "cypress"
|
91
|
+
? `"tsBuildInfoFile": "dist/.tsbuildinfo",\n"rootDir": "src",\n"composite": true,`
|
92
|
+
: "",
|
93
|
+
INIT_PACKAGE_CYPRESS_DEV_DEPS:
|
94
|
+
testSetup === "cypress"
|
95
|
+
? `"@ui5/cypress-ct-ui5-webc": "^0.0.4",\n"cypress": "^13.11.0",`
|
96
|
+
: "",
|
97
|
+
INIT_PACKAGE_CYPRESS_TEST_COMMANDS:
|
98
|
+
testSetup === "cypress"
|
99
|
+
? `"test": "cypress run --component --browser chrome",\n"test:open": "cypress open --component --browser chrome",`
|
100
|
+
: "",
|
101
|
+
INIT_PACKAGE_CYPRESS_ESLINT_IGNORES:
|
102
|
+
testSetup === "cypress" ? `cypress/*\ncypress.config.*` : "",
|
103
103
|
};
|
104
104
|
|
105
|
-
const
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
type: "module",
|
112
|
-
scripts: {
|
113
|
-
"clean": "wc-dev clean",
|
114
|
-
"lint": "wc-dev lint",
|
115
|
-
"start": "wc-dev start",
|
116
|
-
"watch": "wc-dev watch",
|
117
|
-
"build": "wc-dev build",
|
118
|
-
"test": "wc-dev test",
|
119
|
-
"create-ui5-element": "wc-create-ui5-element",
|
120
|
-
"prepublishOnly": "npm run build",
|
121
|
-
},
|
122
|
-
exports: {
|
123
|
-
"./src/*": "./src/*",
|
124
|
-
"./dist/*": "./dist/*",
|
125
|
-
"./package.json": "./package.json",
|
126
|
-
"./bundle.js": "./bundle.js",
|
127
|
-
"./*": "./dist/*",
|
128
|
-
},
|
129
|
-
"dependencies": {
|
130
|
-
"@ui5/webcomponents-base": version,
|
131
|
-
"@ui5/webcomponents-theming": version,
|
132
|
-
},
|
133
|
-
"devDependencies": {
|
134
|
-
"@ui5/webcomponents-tools": version,
|
135
|
-
"chromedriver": "*",
|
136
|
-
"typescript": "^5.6.2"
|
137
|
-
},
|
138
|
-
};
|
139
|
-
|
140
|
-
// Update package.json
|
141
|
-
let destDir = packageName.includes("@") ? packageName.slice(packageName.lastIndexOf("/") + 1) : packageName;
|
105
|
+
const packageBaseName = packageName.includes("@")
|
106
|
+
? packageName.slice(packageName.lastIndexOf("/") + 1)
|
107
|
+
: packageName;
|
108
|
+
const destDir = skipSubfolder
|
109
|
+
? path.join(DEST_DIR)
|
110
|
+
: path.join(DEST_DIR, packageBaseName);
|
142
111
|
|
143
|
-
|
144
|
-
mkdirp.sync(destDir);
|
145
|
-
fs.writeFileSync(path.join(destDir, "package.json"), JSON.stringify(packageContent, null, 2));
|
146
|
-
// Copy files
|
147
|
-
copyFiles(vars, TEMPLATE_DIR, destDir);
|
112
|
+
await processFiles(destDir, vars, testSetup);
|
148
113
|
|
149
114
|
console.log("\nPackage successfully created!\nNext steps:\n");
|
150
115
|
console.log(`$ cd ${destDir}`);
|
151
116
|
|
152
|
-
let userAgentInfo;
|
153
117
|
try {
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
console.log(`$
|
160
|
-
} else {
|
161
|
-
console.log(`$ npm i`);
|
162
|
-
console.log(`$ npm start`);
|
118
|
+
const userAgent = parser(process.env.npm_config_user_agent);
|
119
|
+
userAgent.yarn
|
120
|
+
? console.log(`$ yarn\n$ yarn start`)
|
121
|
+
: console.log(`$ npm i\n$ npm start`);
|
122
|
+
} catch {
|
123
|
+
console.log(`$ npm i\n$ npm start`);
|
163
124
|
}
|
164
125
|
|
165
126
|
console.log("\n");
|
166
127
|
};
|
167
128
|
|
168
|
-
|
129
|
+
async function processFiles(destDir, replacements, testSetup) {
|
130
|
+
const files = await collectFiles(SRC_DIR);
|
131
|
+
const FILE_PATHS_TO_SKIP = [
|
132
|
+
testSetup !== "cypress" ? "cypress" : undefined,
|
133
|
+
].filter(Boolean);
|
134
|
+
|
135
|
+
for (const file of files) {
|
136
|
+
const relativePath = path.relative(SRC_DIR, file);
|
137
|
+
let destPath = path.join(destDir, relativePath);
|
138
|
+
|
139
|
+
if (FILE_PATHS_TO_SKIP.some(filePath => file.includes(filePath))) {
|
140
|
+
// console.log(`Skipped: ${file} -> ${destPath}`);
|
141
|
+
continue;
|
142
|
+
}
|
143
|
+
|
144
|
+
// Component related file based on the user input
|
145
|
+
destPath = destPath.replace(
|
146
|
+
"/MyFirstComponent",
|
147
|
+
`/${replacements.INIT_PACKAGE_VAR_CLASS_NAME}`,
|
148
|
+
);
|
149
|
+
|
150
|
+
// Files that need to be renamed
|
151
|
+
if (FILES_TO_RENAME[relativePath]) {
|
152
|
+
destPath = destPath.replace(
|
153
|
+
relativePath,
|
154
|
+
FILES_TO_RENAME[relativePath],
|
155
|
+
);
|
156
|
+
}
|
157
|
+
|
158
|
+
await fs.mkdir(path.dirname(destPath), { recursive: true });
|
159
|
+
|
160
|
+
if (FILES_TO_COPY.includes(relativePath)) {
|
161
|
+
// Image like files that doesn't need proccessing
|
162
|
+
await fs.copyFile(file, destPath);
|
163
|
+
} else {
|
164
|
+
const content = await fs.readFile(file, { encoding: "utf8" });
|
165
|
+
const replaced = replacePlaceholders(content, replacements);
|
166
|
+
let formatted;
|
167
|
+
try {
|
168
|
+
formatted = await prettier.format(replaced, {
|
169
|
+
useTabs: true,
|
170
|
+
tabWidth: 4,
|
171
|
+
quoteProps: "consistent",
|
172
|
+
arrowParens: "avoid",
|
173
|
+
filepath: file,
|
174
|
+
});
|
175
|
+
// console.log(`Formatted: ${file} -> ${destPath}`);
|
176
|
+
} catch {
|
177
|
+
// console.log(`Not formatted: ${file} -> ${destPath}`);
|
178
|
+
formatted = replaced;
|
179
|
+
}
|
180
|
+
|
181
|
+
await fs.writeFile(destPath, formatted);
|
182
|
+
}
|
183
|
+
|
184
|
+
// console.log(`Processed: ${file} -> ${destPath}`);
|
185
|
+
}
|
186
|
+
}
|
187
|
+
|
169
188
|
const createWebcomponentsPackage = async () => {
|
170
189
|
let response;
|
171
190
|
if (argv.name && !isPackageNameValid(argv.name)) {
|
172
|
-
throw new Error(
|
173
|
-
|
174
|
-
|
175
|
-
if (argv.componentName && !isComponentNameValid(argv.componentName)) {
|
176
|
-
throw new Error("The component name should be a string, starting with a capital letter [A-Z][a-z], for example: Button, MyButton, etc.");
|
191
|
+
throw new Error(
|
192
|
+
"The package name should be a string, starting with letter and containing the following symbols [a-z, A-Z, 0-9].",
|
193
|
+
);
|
177
194
|
}
|
178
195
|
|
179
|
-
if (argv.
|
180
|
-
throw new Error(
|
196
|
+
if (argv.testSetup && !isTestSetupValid(argv.testSetup)) {
|
197
|
+
throw new Error(
|
198
|
+
`The test setup should be a string and one of the following options: ${SUPPORTED_TEST_SETUPS.join(", ")}`,
|
199
|
+
);
|
181
200
|
}
|
182
201
|
|
183
202
|
let packageName = argv.name || "my-package";
|
184
|
-
let componentName =
|
203
|
+
let componentName = "MyComponent";
|
204
|
+
let testSetup = argv.testSetup || "manual";
|
185
205
|
const skipSubfolder = !!argv.skipSubfolder;
|
186
206
|
|
187
207
|
if (argv.skip) {
|
188
|
-
return generateFilesContent(
|
208
|
+
return generateFilesContent(
|
209
|
+
packageName,
|
210
|
+
componentName,
|
211
|
+
skipSubfolder,
|
212
|
+
testSetup,
|
213
|
+
);
|
189
214
|
}
|
190
215
|
|
191
216
|
if (!argv.name) {
|
@@ -193,23 +218,35 @@ const createWebcomponentsPackage = async () => {
|
|
193
218
|
type: "text",
|
194
219
|
name: "name",
|
195
220
|
message: "Package name:",
|
196
|
-
validate:
|
221
|
+
validate: value =>
|
222
|
+
isPackageNameValid(value)
|
223
|
+
? true
|
224
|
+
: "Package name should be a string, starting with a letter and containing the following symbols [a-z, A-Z ,0-9, _, -].",
|
197
225
|
});
|
198
226
|
packageName = response.name;
|
199
227
|
}
|
200
228
|
|
201
|
-
if (!argv.
|
229
|
+
if (!argv.testSetup) {
|
202
230
|
response = await prompts({
|
203
|
-
type: "
|
204
|
-
name: "
|
205
|
-
message: "
|
206
|
-
|
207
|
-
|
231
|
+
type: "select",
|
232
|
+
name: "testSetup",
|
233
|
+
message: "How would you like to set up testing?",
|
234
|
+
choices: [
|
235
|
+
{ title: "Cypress", value: "cypress" },
|
236
|
+
{ title: "I'll set it up manually", value: "manual" },
|
237
|
+
],
|
238
|
+
initial: 0,
|
208
239
|
});
|
209
|
-
|
240
|
+
|
241
|
+
testSetup = response.testSetup;
|
210
242
|
}
|
211
243
|
|
212
|
-
return generateFilesContent(
|
244
|
+
return generateFilesContent(
|
245
|
+
packageName,
|
246
|
+
componentName,
|
247
|
+
skipSubfolder,
|
248
|
+
testSetup,
|
249
|
+
);
|
213
250
|
};
|
214
251
|
|
215
252
|
createWebcomponentsPackage();
|
package/package.json
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ui5/create-webcomponents-package",
|
3
|
-
"version": "0.0.0-
|
3
|
+
"version": "0.0.0-ebd9a4db3",
|
4
4
|
"description": "UI5 Web Components: create package",
|
5
5
|
"author": "SAP SE (https://www.sap.com)",
|
6
6
|
"license": "Apache-2.0",
|
7
|
+
"type": "module",
|
7
8
|
"private": false,
|
8
9
|
"keywords": [
|
9
10
|
"openui5",
|
@@ -21,6 +22,7 @@
|
|
21
22
|
"dependencies": {
|
22
23
|
"mkdirp": "^1.0.4",
|
23
24
|
"npm-config-user-agent-parser": "^1.0.0",
|
25
|
+
"prettier": "^3.5.3",
|
24
26
|
"prompts": "^2.4.1",
|
25
27
|
"yargs": "^17.5.1"
|
26
28
|
}
|
package/template/.eslintignore
CHANGED
@@ -0,0 +1,13 @@
|
|
1
|
+
import {{INIT_PACKAGE_VAR_CLASS_NAME}} from "../../src/{{INIT_PACKAGE_VAR_CLASS_NAME}}.js";
|
2
|
+
|
3
|
+
describe('{{INIT_PACKAGE_VAR_CLASS_NAME}}.cy.tsx', () => {
|
4
|
+
it('playground', () => {
|
5
|
+
cy.mount(<{{INIT_PACKAGE_VAR_CLASS_NAME}} />)
|
6
|
+
|
7
|
+
cy.get("[{{INIT_PACKAGE_VAR_TAG}}]")
|
8
|
+
.click();
|
9
|
+
|
10
|
+
cy.get("[{{INIT_PACKAGE_VAR_TAG}}]")
|
11
|
+
.should("have.prop", "count", 1)
|
12
|
+
})
|
13
|
+
})
|
@@ -0,0 +1,37 @@
|
|
1
|
+
/// <reference types="cypress" />
|
2
|
+
// ***********************************************
|
3
|
+
// This example commands.ts shows you how to
|
4
|
+
// create various custom commands and overwrite
|
5
|
+
// existing commands.
|
6
|
+
//
|
7
|
+
// For more comprehensive examples of custom
|
8
|
+
// commands please read more here:
|
9
|
+
// https://on.cypress.io/custom-commands
|
10
|
+
// ***********************************************
|
11
|
+
//
|
12
|
+
//
|
13
|
+
// -- This is a parent command --
|
14
|
+
// Cypress.Commands.add('login', (email, password) => { ... })
|
15
|
+
//
|
16
|
+
//
|
17
|
+
// -- This is a child command --
|
18
|
+
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
|
19
|
+
//
|
20
|
+
//
|
21
|
+
// -- This is a dual command --
|
22
|
+
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
|
23
|
+
//
|
24
|
+
//
|
25
|
+
// -- This will overwrite an existing command --
|
26
|
+
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
|
27
|
+
//
|
28
|
+
// declare global {
|
29
|
+
// namespace Cypress {
|
30
|
+
// interface Chainable {
|
31
|
+
// login(email: string, password: string): Chainable<void>
|
32
|
+
// drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
|
33
|
+
// dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
|
34
|
+
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
|
35
|
+
// }
|
36
|
+
// }
|
37
|
+
// }
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
6
|
+
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
7
|
+
<title>Components App</title>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
<div data-cy-root></div>
|
11
|
+
</body>
|
12
|
+
</html>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
// ***********************************************************
|
2
|
+
// This example support/component.ts is processed and
|
3
|
+
// loaded automatically before your test files.
|
4
|
+
//
|
5
|
+
// This is a great place to put global configuration and
|
6
|
+
// behavior that modifies Cypress.
|
7
|
+
//
|
8
|
+
// You can change the location of this file or turn off
|
9
|
+
// automatically serving support files with the
|
10
|
+
// 'supportFile' configuration option.
|
11
|
+
//
|
12
|
+
// You can read more here:
|
13
|
+
// https://on.cypress.io/configuration
|
14
|
+
// ***********************************************************
|
15
|
+
|
16
|
+
// Import commands.js using ES2015 syntax:
|
17
|
+
import './commands'
|
18
|
+
|
19
|
+
import { mount } from '@ui5/cypress-ct-ui5-webc'
|
20
|
+
|
21
|
+
// Augment the Cypress namespace to include type definitions for
|
22
|
+
// your custom command.
|
23
|
+
// Alternatively, can be defined in cypress/support/component.d.ts
|
24
|
+
// with a <reference path="./component" /> at the top of your spec.
|
25
|
+
declare global {
|
26
|
+
namespace Cypress {
|
27
|
+
interface Chainable {
|
28
|
+
mount: typeof mount
|
29
|
+
}
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
Cypress.Commands.add('mount', mount)
|
34
|
+
|
35
|
+
// Example use:
|
36
|
+
// cy.mount(MyComponent)
|
@@ -0,0 +1,19 @@
|
|
1
|
+
{
|
2
|
+
"include": [
|
3
|
+
"./**/*"
|
4
|
+
],
|
5
|
+
"compilerOptions": {
|
6
|
+
"module": "NodeNext",
|
7
|
+
"moduleResolution": "nodenext",
|
8
|
+
"jsx": "react-jsx",
|
9
|
+
"jsxImportSource": "@ui5/webcomponents-base",
|
10
|
+
"types": [
|
11
|
+
"cypress"
|
12
|
+
]
|
13
|
+
},
|
14
|
+
"references": [
|
15
|
+
{
|
16
|
+
"path": "../"
|
17
|
+
}
|
18
|
+
]
|
19
|
+
}
|
package/template/env
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
VITE_BUNDLE_PATH="../../dist/bundle.esm.js"
|
package/template/gitignore
CHANGED
@@ -0,0 +1,35 @@
|
|
1
|
+
{
|
2
|
+
"name": "{{INIT_PACKAGE_VAR_NAME}}",
|
3
|
+
"version": "0.0.1",
|
4
|
+
"ui5": {
|
5
|
+
"webComponentsPackage": true
|
6
|
+
},
|
7
|
+
"type": "module",
|
8
|
+
"scripts": {
|
9
|
+
"clean": "wc-dev clean",
|
10
|
+
"lint": "wc-dev lint",
|
11
|
+
"start": "wc-dev start",
|
12
|
+
"watch": "wc-dev watch",
|
13
|
+
"build": "wc-dev build",
|
14
|
+
{{INIT_PACKAGE_CYPRESS_TEST_COMMANDS}}
|
15
|
+
"create-ui5-element": "wc-create-ui5-element",
|
16
|
+
"prepublishOnly": "npm run build"
|
17
|
+
},
|
18
|
+
"exports": {
|
19
|
+
"./src/*": "./src/*",
|
20
|
+
"./dist/*": "./dist/*",
|
21
|
+
"./package.json": "./package.json",
|
22
|
+
"./bundle.js": "./bundle.js",
|
23
|
+
"./*": "./dist/*"
|
24
|
+
},
|
25
|
+
"dependencies": {
|
26
|
+
"@ui5/webcomponents-base": "{{INIT_PACKAGE_VERSION}}",
|
27
|
+
"@ui5/webcomponents-theming": "{{INIT_PACKAGE_VERSION}}"
|
28
|
+
},
|
29
|
+
"devDependencies": {
|
30
|
+
{{INIT_PACKAGE_CYPRESS_DEV_DEPS}}
|
31
|
+
"@ui5/webcomponents-tools": "{{INIT_PACKAGE_VERSION}}",
|
32
|
+
"chromedriver": "*",
|
33
|
+
"typescript": "^5.6.2"
|
34
|
+
}
|
35
|
+
}
|
package/template/src/Assets.ts
CHANGED
@@ -6,10 +6,10 @@ import jsxRenderer from "@ui5/webcomponents-base/dist/renderer/JsxRenderer.js";
|
|
6
6
|
import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js";
|
7
7
|
|
8
8
|
// Template
|
9
|
-
import
|
9
|
+
import {{INIT_PACKAGE_VAR_CLASS_NAME}}Template from "./{{INIT_PACKAGE_VAR_CLASS_NAME}}Template.js";
|
10
10
|
|
11
11
|
// Styles
|
12
|
-
import
|
12
|
+
import {{INIT_PACKAGE_VAR_CLASS_NAME}}Css from "./generated/themes/{{INIT_PACKAGE_VAR_CLASS_NAME}}.css.js";
|
13
13
|
|
14
14
|
import { COUNT } from "./generated/i18n/i18n-defaults.js";
|
15
15
|
|
@@ -18,20 +18,20 @@ import { COUNT } from "./generated/i18n/i18n-defaults.js";
|
|
18
18
|
*
|
19
19
|
* <h3 class="comment-api-title">Overview</h3>
|
20
20
|
*
|
21
|
-
* The <code>INIT_PACKAGE_VAR_TAG</code> component is a demo component that displays some text.
|
21
|
+
* The <code>{{INIT_PACKAGE_VAR_TAG}}</code> component is a demo component that displays some text.
|
22
22
|
*
|
23
23
|
* @constructor
|
24
24
|
* @extends UI5Element
|
25
25
|
* @public
|
26
26
|
*/
|
27
27
|
@customElement({
|
28
|
-
tag: "INIT_PACKAGE_VAR_TAG",
|
28
|
+
tag: "{{INIT_PACKAGE_VAR_TAG}}",
|
29
29
|
renderer: jsxRenderer,
|
30
|
-
styles:
|
31
|
-
template:
|
30
|
+
styles: {{INIT_PACKAGE_VAR_CLASS_NAME}}Css,
|
31
|
+
template: {{INIT_PACKAGE_VAR_CLASS_NAME}}Template,
|
32
32
|
})
|
33
|
-
class INIT_PACKAGE_VAR_CLASS_NAME extends UI5Element {
|
34
|
-
@i18n("INIT_PACKAGE_VAR_NAME")
|
33
|
+
class {{INIT_PACKAGE_VAR_CLASS_NAME}} extends UI5Element {
|
34
|
+
@i18n("{{INIT_PACKAGE_VAR_NAME}}")
|
35
35
|
static i18nBundle: I18nBundle;
|
36
36
|
|
37
37
|
/**
|
@@ -47,10 +47,10 @@ class INIT_PACKAGE_VAR_CLASS_NAME extends UI5Element {
|
|
47
47
|
}
|
48
48
|
|
49
49
|
get counterText() {
|
50
|
-
return INIT_PACKAGE_VAR_CLASS_NAME.i18nBundle.getText(COUNT);
|
50
|
+
return {{INIT_PACKAGE_VAR_CLASS_NAME}}.i18nBundle.getText(COUNT);
|
51
51
|
}
|
52
52
|
}
|
53
53
|
|
54
|
-
INIT_PACKAGE_VAR_CLASS_NAME.define();
|
54
|
+
{{INIT_PACKAGE_VAR_CLASS_NAME}}.define();
|
55
55
|
|
56
|
-
export default INIT_PACKAGE_VAR_CLASS_NAME;
|
56
|
+
export default {{INIT_PACKAGE_VAR_CLASS_NAME}};
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import type INIT_PACKAGE_VAR_CLASS_NAME from "./INIT_PACKAGE_VAR_CLASS_NAME.js";
|
1
|
+
import type {{INIT_PACKAGE_VAR_CLASS_NAME}} from "./{{INIT_PACKAGE_VAR_CLASS_NAME}}.js";
|
2
2
|
|
3
|
-
export default function
|
3
|
+
export default function {{INIT_PACKAGE_VAR_CLASS_NAME}}Template(this: {{INIT_PACKAGE_VAR_CLASS_NAME}}) {
|
4
4
|
return (
|
5
5
|
<div class="root" onClick={this.onClick}>
|
6
6
|
{this.counterText} :: {this.count}
|
@@ -9,11 +9,12 @@ import { getNoConflict, setNoConflict } from "@ui5/webcomponents-base/dist/confi
|
|
9
9
|
import { getFirstDayOfWeek } from "@ui5/webcomponents-base/dist/config/FormatSettings.js";
|
10
10
|
|
11
11
|
// Enable additional themes and i18n texts
|
12
|
-
import "./
|
12
|
+
import "./Assets.js";
|
13
13
|
|
14
|
-
// Import your web components here from the
|
15
|
-
import "./
|
14
|
+
// Import your web components here from the src/ directory
|
15
|
+
import "./{{INIT_PACKAGE_VAR_CLASS_NAME}}.js";
|
16
16
|
|
17
|
+
// @ts-expect-error
|
17
18
|
window["sap-ui-webcomponents-bundle"] = {
|
18
19
|
renderFinished,
|
19
20
|
configuration: {
|
@@ -3,6 +3,7 @@ body {
|
|
3
3
|
background-color: var(--sapBackgroundColor);
|
4
4
|
font-size: var(--sapFontSize);
|
5
5
|
font-family: var(--sapFontFamily);
|
6
|
+
padding: 2rem;
|
6
7
|
}
|
7
8
|
|
8
9
|
h1 {
|
@@ -11,31 +12,78 @@ h1 {
|
|
11
12
|
}
|
12
13
|
|
13
14
|
h2 {
|
14
|
-
font-size: var(--
|
15
|
-
|
15
|
+
font-size: var(--sapFontHeader4Size);
|
16
|
+
}
|
17
|
+
|
18
|
+
a {
|
19
|
+
margin: 0.25rem;
|
20
|
+
padding: 0.5rem;
|
21
|
+
}
|
22
|
+
|
23
|
+
a.link {
|
24
|
+
color: var(--sapLinkColor);
|
16
25
|
}
|
17
26
|
|
18
|
-
.
|
27
|
+
a.theme-link {
|
28
|
+
color: var(--sapButton_Emphasized_TextColor);
|
29
|
+
background-color: var(--sapButton_Emphasized_Background);
|
30
|
+
text-decoration: none;
|
31
|
+
border-radius: 0.25rem;
|
32
|
+
}
|
33
|
+
|
34
|
+
a.lang-link {
|
35
|
+
color: var(--sapButton_Attention_TextColor);
|
36
|
+
background-color: var(--sapButton_Attention_Background);
|
37
|
+
text-decoration: none;
|
38
|
+
border-radius: 0.25rem;
|
39
|
+
}
|
40
|
+
|
41
|
+
.app {
|
19
42
|
display: flex;
|
20
|
-
align-items: center;
|
21
|
-
justify-content: center;
|
22
43
|
flex-direction: column;
|
44
|
+
align-items: center;
|
45
|
+
}
|
46
|
+
|
47
|
+
.app-nav {
|
48
|
+
display: flex;
|
49
|
+
width: 100%;
|
50
|
+
flex-direction: row;
|
51
|
+
justify-content: flex-end;
|
23
52
|
}
|
24
53
|
|
25
54
|
.app-logo {
|
26
|
-
height:
|
27
|
-
width:
|
55
|
+
height: 5rem;
|
56
|
+
width: 5rem;
|
28
57
|
}
|
29
58
|
|
30
|
-
.app-
|
31
|
-
|
59
|
+
.app-header {
|
60
|
+
display: flex;
|
61
|
+
flex-direction: row;
|
62
|
+
align-items: center;
|
32
63
|
}
|
33
64
|
|
34
|
-
.app-
|
35
|
-
|
65
|
+
.app-main {
|
66
|
+
display: flex;
|
67
|
+
flex-direction: row;
|
68
|
+
align-items: flex-start;
|
69
|
+
padding-top: 2rem;
|
36
70
|
}
|
37
71
|
|
38
|
-
|
39
|
-
|
40
|
-
|
72
|
+
.app-main-demo {
|
73
|
+
padding: 2rem;
|
74
|
+
border-radius: 0.5rem;
|
75
|
+
box-sizing: border-box;
|
76
|
+
background-color: var(--sapTile_Background);
|
77
|
+
}
|
78
|
+
|
79
|
+
.app-main-settings {
|
80
|
+
display: flex;
|
81
|
+
flex-direction: column;
|
82
|
+
padding: 0 2rem;
|
83
|
+
}
|
84
|
+
|
85
|
+
@media (max-width: 768px) {
|
86
|
+
.app-main {
|
87
|
+
flex-direction: column;
|
88
|
+
}
|
41
89
|
}
|
@@ -1,57 +1,53 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
|
-
<html>
|
2
|
+
<html lang="en">
|
3
3
|
|
4
4
|
<head>
|
5
5
|
<meta charset="utf-8">
|
6
|
-
|
7
|
-
<title>INIT_PACKAGE_VAR_TAG</title>
|
6
|
+
<title>UI5 Web Components</title>
|
8
7
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
9
8
|
<meta charset="utf-8">
|
10
|
-
|
11
|
-
<script data-ui5-config type="application/json">
|
12
|
-
{
|
13
|
-
"theme": "sap_horizon_dark",
|
14
|
-
"language": "EN"
|
15
|
-
}
|
16
|
-
</script>
|
17
|
-
|
18
9
|
<link rel="stylesheet" type="text/css" href="./css/index.css">
|
19
|
-
<script src="
|
10
|
+
<script src="%VITE_BUNDLE_PATH%" type="module"></script>
|
20
11
|
</head>
|
21
12
|
|
22
13
|
<body>
|
23
14
|
<div class="app">
|
24
|
-
<
|
25
|
-
|
26
|
-
|
27
|
-
<
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
<
|
38
|
-
<
|
39
|
-
<
|
15
|
+
<nav class="app-nav">
|
16
|
+
<a class="link" href="https://sap.github.io/ui5-webcomponents/">Website</a>
|
17
|
+
<a class="link" href="https://sap.github.io/ui5-webcomponents/components/">Components</a>
|
18
|
+
<a class="link" href="https://sap.github.io/ui5-webcomponents/docs/development/package/">Development</a>
|
19
|
+
</nav>
|
20
|
+
|
21
|
+
<header class="app-header">
|
22
|
+
<a href="https://sap.github.io/ui5-webcomponents/" target="_blank"><img src="./img/logo.png" class="app-logo" alt="logo"/></a>
|
23
|
+
<h1>UI5 Web Components</h1>
|
24
|
+
</header>
|
25
|
+
|
26
|
+
<main class="app-main">
|
27
|
+
<div class="app-main-demo">
|
28
|
+
<h2>Congrats! It's your First Web Component 🎉</h2>
|
29
|
+
<div> <pre><{{INIT_PACKAGE_VAR_TAG}}></{{INIT_PACKAGE_VAR_TAG}}> </pre></div>
|
30
|
+
<{{INIT_PACKAGE_VAR_TAG}} id="myFirstComponent"></{{INIT_PACKAGE_VAR_TAG}}>
|
40
31
|
</div>
|
41
32
|
|
42
|
-
<
|
43
|
-
|
44
|
-
<
|
45
|
-
|
46
|
-
|
47
|
-
|
33
|
+
<div class="app-main-settings">
|
34
|
+
<h3>Switch theme</h3>
|
35
|
+
<div style="display: grid; grid-template-columns: 1fr 1fr;">
|
36
|
+
<a class="link theme-link" href="?sap-ui-theme=sap_horizon">Horizon Morning</a>
|
37
|
+
<a class="link theme-link" href="?sap-ui-theme=sap_horizon_dark">Horizon Evening</a>
|
38
|
+
<a class="link theme-link" href="?sap-ui-theme=sap_horizon_hcb">High Contrast Black</a>
|
39
|
+
<a class="link theme-link" href="?sap-ui-theme=sap_horizon_hcw">High Contrast White</a>
|
40
|
+
</div>
|
41
|
+
|
42
|
+
<h3>Switch language</h3>
|
43
|
+
<div style="display: grid; grid-template-columns: 1fr 1fr;">
|
44
|
+
<a class="link lang-link" href="?sap-ui-language=en">English</a>
|
45
|
+
<a class="link lang-link" href="?sap-ui-language=de">German</a>
|
46
|
+
<a class="link lang-link" href="?sap-ui-language=es">Spanish</a>
|
47
|
+
<a class="link lang-link" href="?sap-ui-language=fr">French</a>
|
48
|
+
</div>
|
48
49
|
</div>
|
49
|
-
</
|
50
|
-
|
51
|
-
<div class="app-docs">
|
52
|
-
<h2>Documentation</h2>
|
53
|
-
<a class="link" href="https://sap.github.io/ui5-webcomponents/docs/development/custom-UI5-Web-Components-Packages/">Custom Component Development</a>
|
54
|
-
</div>
|
50
|
+
</main>
|
55
51
|
</div>
|
56
52
|
</body>
|
57
53
|
</html>
|
@@ -1 +0,0 @@
|
|
1
|
-
module.exports = require("@ui5/webcomponents-tools/components-package/wdio.js"); // eslint-disable-line
|
@@ -1,13 +0,0 @@
|
|
1
|
-
import { assert } from "chai";
|
2
|
-
|
3
|
-
describe("INIT_PACKAGE_VAR_TAG rendering", async () => {
|
4
|
-
before(async () => {
|
5
|
-
await browser.url("test/pages/index.html");
|
6
|
-
});
|
7
|
-
|
8
|
-
it("tests if web component is correctly rendered", async () => {
|
9
|
-
const innerContent = await browser.$("#myFirstComponent").shadow$("div");
|
10
|
-
|
11
|
-
assert.ok(innerContent, "content rendered");
|
12
|
-
});
|
13
|
-
});
|