generated from SAP/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Add fixtures for XML Templating checks
- Loading branch information
Showing
10 changed files
with
204 additions
and
0 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
...es/linter/projects/com.ui5.troublesome.app/webapp/controller/TemplatingMain.controller.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,7 @@ | ||
sap.ui.define(["./BaseController"], function (BaseController) { | ||
"use strict"; | ||
|
||
const TemplatingMainController = BaseController.extend("com.ui5.troublesome.app.controller.TemplatingMain", { | ||
}); | ||
return TemplatingMainController; | ||
}); |
26 changes: 26 additions & 0 deletions
26
test/fixtures/linter/projects/com.ui5.troublesome.app/webapp/view/TemplatingMain.view.xml
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,26 @@ | ||
<mvc:View | ||
controllerName="com.ui5.troublesome.app.controller.TemplatingMain" | ||
xmlns="sap.m" | ||
xmlns:core="sap.ui.core" | ||
xmlns:layout="sap.ui.layout" | ||
xmlns:mvc="sap.ui.core.mvc" | ||
xmlns:template="http://schemas.sap.com/sapui5/extension/sap.ui.core.template/1"> | ||
<layout:VerticalLayout class="sapUiSmallMarginBottom"> | ||
<template:alias name=".formatParts" value="com.ui5.troublesome.app.helpers.Helper.formatParts"> | ||
<template:alias name=".id" value="com.ui5.troublesome.app.helpers.Helper.id"> | ||
<template:with path="meta>/" var="fieldGroup"> | ||
<template:with path="meta>entityType" helper="sap.ui.model.odata.AnnotationHelper.gotoEntityType" var="entityType"> | ||
<template:if test="{entityType>com.sap.vocabularies.UI.v1.LineItem}"> | ||
<Table headerText="Items" includeItemInSelection="true" mode="SingleSelectMaster" | ||
selectionChange="onSelectionChange" items="{:= '{path:\'/' + ${meta>name} + '\', length: 5}' }"> | ||
<template:with path="entityType>com.sap.vocabularies.UI.v1.LineItem" var="target"> | ||
<core:Fragment fragmentName="com.ui5.troublesome.app.view.TemplatingTable" type="XML"/> | ||
</template:with> | ||
</Table> | ||
</template:if> | ||
</template:with> | ||
</template:with> | ||
</template:alias> | ||
</template:alias> | ||
</layout:VerticalLayout> | ||
</mvc:View> |
56 changes: 56 additions & 0 deletions
56
...fixtures/linter/projects/com.ui5.troublesome.app/webapp/view/TemplatingTable.fragment.xml
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,56 @@ | ||
<core:FragmentDefinition | ||
xmlns="sap.m" | ||
xmlns:core="sap.ui.core" | ||
xmlns:template="http://schemas.sap.com/sapui5/extension/sap.ui.core.template/1"> | ||
<columns> | ||
<template:repeat list="{target>}" var="field"> | ||
<template:if test="{field>Value}"> | ||
<Column> | ||
<Text text="{path: 'field>Label', formatter: 'sap.ui.model.odata.AnnotationHelper.format'}"/> | ||
</Column> | ||
</template:if> | ||
<template:if test="{field>Action}"> | ||
<Column demandPopin="true" minScreenWidth="1800px" popinDisplay="WithoutHeader"> | ||
<Text text="{path: 'field>Label', formatter: 'sap.ui.model.odata.AnnotationHelper.format'}"/> | ||
</Column> | ||
</template:if> | ||
</template:repeat> | ||
</columns> | ||
<ColumnListItem> | ||
<template:repeat list="{target>}" var="field"> | ||
<template:if test="{field>Value}"> | ||
<template:if test="{field>Target}"> | ||
<template:then> | ||
<template:with path="field>Target" helper="sap.ui.model.odata.AnnotationHelper.resolvePath" var="entityType"> | ||
<Link text="{path: 'field>Value', formatter: 'sap.ui.model.odata.AnnotationHelper.format'}" press="onDetailsPressed"> | ||
<dependents> | ||
<template:with path="entityType>com.sap.vocabularies.UI.v1.HeaderInfo" var="headerInfo"> | ||
<Popover binding="{path: 'field>Target', formatter: 'sap.ui.model.odata.AnnotationHelper.getNavigationPath'}" | ||
title="{path: 'headerInfo>Title/Value', formatter: 'sap.ui.model.odata.AnnotationHelper.format'}"> | ||
</Popover> | ||
</template:with> | ||
</dependents> | ||
</Link> | ||
</template:with> | ||
</template:then> | ||
<template:else> | ||
<Text text="{path: 'field>Value', formatter: 'sap.ui.model.odata.AnnotationHelper.format'}" /> | ||
</template:else> | ||
</template:if> | ||
</template:if> | ||
<template:if test="{field>Action}"> | ||
<template:with path="field>Action" helper="sap.ui.model.odata.AnnotationHelper.gotoFunctionImport" var="function"> | ||
<template:if test="{function>com.sap.vocabularies.Common.v1.IsActionCritical}"> | ||
<template:then> | ||
<Button text="{path: 'field>Label', formatter: 'sap.ui.model.odata.AnnotationHelper.format'}" | ||
icon="{= ${function>com.sap.vocabularies.Common.v1.IsActionCritical/Bool} !== 'false' ? 'sap-icon://notification' : ''}" /> | ||
</template:then> | ||
<template:else> | ||
<Button text="{path: 'field>Label', formatter: 'sap.ui.model.odata.AnnotationHelper.format'}" /> | ||
</template:else> | ||
</template:if> | ||
</template:with> | ||
</template:if> | ||
</template:repeat> | ||
</ColumnListItem> | ||
</core:FragmentDefinition> |
36 changes: 36 additions & 0 deletions
36
test/fixtures/linter/rules/NoGlobals/XMLTemplating.view.xml
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 @@ | ||
<mvc:View | ||
controllerName="sap.ui.core.sample.ViewTemplate.scenario.Detail" | ||
template:require="{AH: 'sap/ui/model/odata/AnnotationHelper', | ||
Helper: 'sap/ui/core/sample/ViewTemplate/scenario/Helper'}" | ||
xmlns="sap.m" | ||
xmlns:core="sap.ui.core" | ||
xmlns:layout="sap.ui.layout" | ||
xmlns:mvc="sap.ui.core.mvc" | ||
xmlns:template="http://schemas.sap.com/sapui5/extension/sap.ui.core.template/1"> | ||
|
||
<!-- Global access of value function --> | ||
<template:alias name=".formatParts" value="sap.ui.core.sample.ViewTemplate.scenario.Helper.formatParts"> | ||
|
||
<!-- Negative test: Access via local name --> | ||
<template:alias name=".id" value="Helper.id"> | ||
|
||
<!-- Global access of helper function --> | ||
<template:with path="meta>entityType" helper="sap.ui.model.odata.AnnotationHelper.gotoEntityType" var="entityType"> | ||
|
||
<!-- Negative test: Access via local name --> | ||
<template:with path="meta>entityType" helper="AH.gotoEntityType" var="entityType2"> | ||
|
||
<template:if test="{entityType>com.sap.vocabularies.UI.v1.LineItem}"> | ||
<Table headerText="Items" includeItemInSelection="true" mode="SingleSelectMaster" | ||
selectionChange="onSelectionChange" items="{:= '{path:\'/' + ${meta>name} + '\', length: 5}' }"> | ||
<template:with path="entityType>com.sap.vocabularies.UI.v1.LineItem" var="target"> | ||
<core:Fragment fragmentName="sap.ui.core.sample.ViewTemplate.scenario.Table" type="XML"/> | ||
</template:with> | ||
</Table> | ||
</template:if> | ||
|
||
</template:with> | ||
</template:with> | ||
</template:alias> | ||
</template:alias> | ||
</mvc:View> |
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.
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.
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.