Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/core/update/Update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export async function updateWorkspace(rootPath: string): Promise<boolean> {
guideLink = "https://www.infragistics.com/products/ignite-ui-react/react/components/general-licensing";
logicFilesExtension = "tsx";
styleExtensions = ["css"];
shouldUpgradeHTML = true;
break;
case "webcomponents":
guideLink = "https://www.infragistics.com/products/ignite-ui-web-components/web-components/components/general-licensing";
Expand Down
56 changes: 52 additions & 4 deletions spec/unit/update-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ title = 'igniteui-angular example';
(fsSpy.fileExists as jasmine.Spy).and.returnValue(true);
(fsSpy.glob as jasmine.Spy).and.returnValues // per workspace
([ "package.json" ], // root package.json
[], // html files
[], // logic files
[], // for each style extension
[]); // inner package.json files
Expand All @@ -525,7 +526,7 @@ title = 'igniteui-angular example';
}
}));
expect(fsSpy.writeFile).toHaveBeenCalledTimes(1);
expect(fsSpy.glob).toHaveBeenCalledTimes(4);
expect(fsSpy.glob).toHaveBeenCalledTimes(5);
});

it("Should update import paths in files correctly", async () => {
Expand Down Expand Up @@ -609,9 +610,55 @@ export default function Home() {
- run: echo "//packages.infragistics.com/npm/js-licensed/:always-auth=true" >> ~/.npmrc
- run: npm i # replace with 'npm ci' after committing lock file from first install
# end content
`}];
`},
{
path: "index.html",
content:
`<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="/favicon.ico" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta name="theme-color" content="#000000" />
<title>IgniteUI for React</title>
<link rel="stylesheet" href="./styles.css" />
<link rel="stylesheet"
href="node_modules/igniteui-react-grids/grids/themes/light/bootstrap.css"
</head>
<body>
<div id="root"></div>
</body>
<script type="module" src="/src/main.tsx"></script>
</html>`,
expected:
`<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="/favicon.ico" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta name="theme-color" content="#000000" />
<title>IgniteUI for React</title>
<link rel="stylesheet" href="./styles.css" />
<link rel="stylesheet"
href="node_modules/@infragistics/igniteui-react-grids/grids/themes/light/bootstrap.css"
</head>
<body>
<div id="root"></div>
</body>
<script type="module" src="/src/main.tsx"></script>
</html>`
},];
(fsSpy.glob as jasmine.Spy).and.returnValues // per workspace
([ "package.json" ], // root package.json
["index.html"], // html file
[ "src/home.tsx" ], // logic files
[], // for each style extension
[]); // inner package.json files
Expand All @@ -628,7 +675,7 @@ export default function Home() {
for (const fileEntry of mockFileArray) {
expect((fsSpy.writeFile as jasmine.Spy)).toHaveBeenCalledWith(fileEntry.path, fileEntry.expected);
}
expect(fsSpy.glob).toHaveBeenCalledTimes(4);
expect(fsSpy.glob).toHaveBeenCalledTimes(5);
});

it("Should update package.json files from workspaces", async () => {
Expand Down Expand Up @@ -719,6 +766,7 @@ export default function Home() {
(fsSpy.fileExists as jasmine.Spy).and.returnValue(true);
(fsSpy.glob as jasmine.Spy).and.returnValues // per workspace
([ "package.json" ], // root package.json
[], // index.html
[], // projectA logic files
[], // projectA for each style extension
[ "./projectA/package.json" ], // projectA package.json
Expand All @@ -740,7 +788,7 @@ export default function Home() {
for (const fileEntry of mockFileArray) {
expect((fsSpy.writeFile as jasmine.Spy)).toHaveBeenCalledWith(fileEntry.path, fileEntry.expected);
}
expect(fsSpy.glob).toHaveBeenCalledTimes(7);
expect(fsSpy.glob).toHaveBeenCalledTimes(8);
});
});

Expand Down
Loading