Skip to content

Commit

Permalink
feat: use new icon registry (webc) (#308)
Browse files Browse the repository at this point in the history
* chore(deps): updated package-lock, missed on last update to 107

* refactor(timeline-view): remove unused deps/namespaces in view, remove testing function parameter

* refactor(icon-registry): move to new webc icon registry, adjust icon loading"

* chore: merge dependency bump
  • Loading branch information
wridgeu authored Nov 4, 2022
1 parent 5f8fe81 commit ac709c7
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 34 deletions.
16 changes: 5 additions & 11 deletions src/controller/Timeline.controller.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
import Event from "sap/ui/base/Event";
import JSONModel from "sap/ui/model/json/JSONModel";
import BaseController from "./BaseController";
import { registerIconLoader } from "sap/ui/webc/common/thirdparty/base/AssetRegistry";
import { registerIconLoader } from "sap/ui/webc/common/thirdparty/base/asset-registries/Icons";
import IconCollection from "org/openui5/bestofui5/resources/font-awesome/fa-brands-sap";

/**
* @namespace org.openui5.bestofui5.controller
*/
export default class Timeline extends BaseController {
public onInit(): void {
this.getRouter().getRoute("timeline").attachPatternMatched(this.onPatternMatched, this);
const loadIconsBundle = async (collection) => {
let iconData = null;
iconData = (
await new Promise(function (resolve, reject) {
sap.ui.require(["org/openui5/bestofui5/resources/font-awesome/fa-brands-sap"], resolve, reject);
})
).default;
return iconData;
};
registerIconLoader("font-awesome-icons", loadIconsBundle);
registerIconLoader("font-awesome-icons", () => {
return IconCollection;
});
}

public onNameClick(event: Event): void {
Expand Down
2 changes: 1 addition & 1 deletion src/localService/mockData/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -1585,7 +1585,7 @@
"@wdio/local-runner": "^7.19.7",
"@wdio/mocha-framework": "^7.19.7",
"@wdio/spec-reporter": "^7.19.7",
"chromedriver": "^103.0.0",
"chromedriver": "^107.0.1",
"cross-env": "^7.0.3",
"deepmerge": "^4.2.2",
"eslint": "^8.16.0",
Expand Down
14 changes: 6 additions & 8 deletions src/resources/font-awesome/fa-brands-sap.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/test/e2e/basics.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe("ui5 basic", () => {
it("should have the right title", async () => {
// wait for calculation of browser title
try {
await $("filtekuzfutkfk424214").waitForExist({ timeout: 5000 });
await $("filtekuzfutkfk424214").waitForExist({ timeout: 10000 });
} catch (error) {}
const title = await browser.getTitle();
expect(title).toEqual("Hot Packages - Best of UI5");
Expand Down
15 changes: 2 additions & 13 deletions src/view/Timeline.view.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
<mvc:View
xmlns:commons="sap.suite.ui.commons"
controllerName="org.openui5.bestofui5.controller.Timeline"
xmlns:m="sap.m"
xmlns="sap.ui.webc.fiori"
xmlns:webcm="sap.ui.webc.main"
xmlns:md="cc.md"
xmlns:mvc="sap.ui.core.mvc"
xmlns:core="sap.ui.core"
displayBlock="true"
height="100%"
>
<mvc:View controllerName="org.openui5.bestofui5.controller.Timeline" xmlns:m="sap.m" xmlns="sap.ui.webc.fiori" xmlns:md="cc.md" xmlns:mvc="sap.ui.core.mvc" displayBlock="true" height="100%">
<m:FlexBox
width="{= ${device>/system/phone} === true ? '' : '1024px' }"
height="100%"
Expand All @@ -32,7 +21,7 @@
formatter: 'org.openui5.bestofui5.controller.BaseController.formatter.formatTimelineIcon'
}"
nameClickable="true"
nameClick=".onNameClick($event, 'mycustomString')"
nameClick=".onNameClick"
subtitleText="{= ${i18n>list_item_tag_updated}.replace('{0}', ${
path: 'versions>date',
type: 'sap.ui.model.type.Date',
Expand Down

0 comments on commit ac709c7

Please sign in to comment.