generated from SAP/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Detect override of control "rerender"
JIRA: CPOUI5FOUNDATION-939
- Loading branch information
Showing
6 changed files
with
210 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
test/fixtures/linter/rules/renderer/ControlRerenderOverride.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
sap.ui.define(["sap/ui/core/Control"], function(Control, Button) { | ||
const Example1 = Control.extend("sap.ui.demo.linter.controls.Example1", { | ||
metadata: {}, | ||
|
||
rerender: function() { | ||
console.log("Overriding rerender method"); | ||
return Control.prototype.rerender.apply(this, arguments); | ||
}, | ||
|
||
renderer: { | ||
apiVersion: 2, | ||
render: function(oRm, oControl) { | ||
oRm.openStart("div", oControl); | ||
oRm.openEnd(); | ||
oRm.close("div"); | ||
} | ||
} | ||
}); | ||
|
||
const Example2 = Control.extend("sap.ui.demo.linter.controls.Example2", { | ||
metadata: {}, | ||
|
||
"rerender": function() { | ||
console.log("Overriding rerender method without calling super method"); | ||
}, | ||
|
||
renderer: { | ||
apiVersion: 2, | ||
render: function(oRm, oControl) { | ||
oRm.openStart("div", oControl); | ||
oRm.openEnd(); | ||
oRm.close("div"); | ||
} | ||
} | ||
}); | ||
}); |
44 changes: 44 additions & 0 deletions
44
test/fixtures/linter/rules/renderer/ControlRerenderOverride.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import Control from "sap/ui/core/Control"; | ||
import type { MetadataOptions } from "sap/ui/core/Element"; | ||
import RenderManager from "sap/ui/core/RenderManager"; | ||
|
||
/** | ||
* @namespace sap.ui.demo.linter.controls | ||
*/ | ||
class Example1 extends Control { | ||
static readonly metadata: MetadataOptions = {} | ||
|
||
rerender() { | ||
console.log("Overriding rerender method"); | ||
return super.rerender(); | ||
} | ||
|
||
static renderer = { | ||
apiVersion: 2, | ||
render: function(rm: RenderManager, control: Example1) { | ||
rm.openStart("div", control); | ||
rm.openEnd(); | ||
rm.close("div"); | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* @namespace sap.ui.demo.linter.controls | ||
*/ | ||
class Example2 extends Control { | ||
static readonly metadata: MetadataOptions = {} | ||
|
||
rerender() { | ||
console.log("Overriding rerender method without calling super method"); | ||
} | ||
|
||
static renderer = { | ||
apiVersion: 2, | ||
render: function(rm: RenderManager, control: Example1) { | ||
rm.openStart("div", control); | ||
rm.openEnd(); | ||
rm.close("div"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.