Skip to content

Commit bb20759

Browse files
committed
test: Add fixtures for Core APIs
1 parent 36d7ccb commit bb20759

File tree

4 files changed

+105
-0
lines changed

4 files changed

+105
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
sap.ui.define(["sap/ui/core/Core",
2+
"sap/ui/core/Theming",
3+
"sap/ui/core/IntervalTrigger",
4+
"sap/base/i18n/Localization",
5+
"sap/ui/core/Control",
6+
"sap/ui/core/Element",
7+
"sap/ui/core/Component"
8+
], function(Core, Theming, IntervalTrigger, Localization, Control, Element, Component) {
9+
Theming.applyTheme("themeName");
10+
Core.applyTheme("custom_theme", "find/my/theme/here");
11+
12+
Core.ready(function() {console.log();});
13+
14+
Core.ready(function() {console.log();});
15+
16+
IntervalTrigger.addListener(function() {console.log();});
17+
Core.attachIntervalTimer(function() {console.log();}, {});
18+
19+
Localization.attachChange(function() {console.log();});
20+
Core.attachLocalizationChanged(function() {console.log();}, {});
21+
22+
Theming.attachApplied(function() {console.log();});
23+
Core.attachThemeChanged(function() {console.log();}, {});
24+
25+
Control.getControlsByFieldGroupId("id");
26+
Control.getControlsByFieldGroupId(["id", "id2"]);
27+
28+
Element.getElementById("id");
29+
30+
Component.create({name: "componentName", url: "find/my/comp/here", id: "id", settings: {"settingsKey": "..."}});
31+
Component.create({name: "componentName", url: "find/my/comp/here", id: "id", settings: {"settingsKey": "..."}, component: {}});
32+
33+
IntervalTrigger.removeListener(function() {console.log();});
34+
Core.detachIntervalTimer(function() {console.log();}, {});
35+
36+
Localization.detachChange(function() {console.log();});
37+
Core.detachLocalizationChanged(function() {console.log();}, {});
38+
39+
Theming.detachApplied(function() {console.log();});
40+
Core.detachThemeChanged(function() {console.log();}, {});
41+
42+
Component.get("componentId");
43+
44+
Element.getElementById("controlId");
45+
46+
// Use replacement only if Element.getActiveElement() is != undefined:
47+
(Element.getActiveElement()) ? Element.getId(Element.getActiveElement()) : Core.getCurrentFocusedControlId();
48+
49+
Element.getElementById("elementId");
50+
});
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
sap.ui.define(["sap/ui/core/Core",], function(Core) {
2+
Core.applyTheme("themeName");
3+
Core.applyTheme("custom_theme", "find/my/theme/here"); // Should not be autofixed if there is a 2nd argument
4+
5+
Core.attachInit(function() {console.log();});
6+
7+
Core.attachInitEvent(function() {console.log();});
8+
9+
Core.attachIntervalTimer(function() {console.log();});
10+
Core.attachIntervalTimer(function() {}, {}); // Should not be autofixed if there is a 2nd argument
11+
12+
Core.attachLocalizationChanged(function() {console.log();});
13+
Core.attachLocalizationChanged(function() {console.log();}, {}); // Should not be autofixed if there is a 2nd argument
14+
15+
Core.attachThemeChanged(function() {console.log();});
16+
Core.attachThemeChanged(function() {console.log();}, {}); // Should not be autofixed if there is a 2nd argument
17+
18+
Core.byFieldGroupId("id");
19+
Core.byFieldGroupId(["id", "id2"]);
20+
21+
Core.byId("id");
22+
23+
Core.createComponent("componentName", "find/my/comp/here", "id", {"settingsKey": "..."}); // First argument is a string
24+
Core.createComponent({name: "componentName", url: "find/my/comp/here", id: "id", settings: {"settingsKey": "..."}, component: {}}); // First argument is an object
25+
26+
Core.detachIntervalTimer(function() {console.log();});
27+
Core.detachIntervalTimer(function() {console.log();}, {}); // Should not be autofixed if there is a 2nd argument
28+
29+
Core.detachLocalizationChanged(function() {console.log();});
30+
Core.detachLocalizationChanged(function() {console.log();}, {}); // Should not be autofixed if there is a 2nd argument
31+
32+
Core.detachThemeChanged(function() {console.log();});
33+
Core.detachThemeChanged(function() {console.log();}, {}); // Should not be autofixed if there is a 2nd argument
34+
35+
Core.getComponent("componentId");
36+
37+
Core.getControl("controlId");
38+
39+
Core.getCurrentFocusedControlId();
40+
41+
Core.getElementById("elementId");
42+
//TODO:
43+
44+
});
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
//TODO:
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
sap.ui.define([], function() {
2+
sap.ui.getCore().applyTheme("sap_horizon");
3+
sap.ui.getCore().applyTheme("custom_theme", "https://example.com/"); // Should not be autofixed due to the 2nd parameter
4+
sap.ui.getCore().attachInit(function() {});
5+
sap.ui.getCore().attachInitEvent(function() {});
6+
sap.ui.getCore().attachIntervalTimer(function() {});
7+
sap.ui.getCore().attachIntervalTimer(function() {}, {}); // Should not be autofixed if the 2nd parameter != undefined
8+
//TODO: ...
9+
});
10+

0 commit comments

Comments
 (0)