Skip to content

Commit

Permalink
fix: add extra parameter to condition and fix spelling errors in ZapC…
Browse files Browse the repository at this point in the history
…onfig(project-chip#1385)

* fix: remove wrong condition from ZapConfig

* fix: add extra paramter to condition and fix spelling errors

* fix: typo

* feat: add cypress test for mode
  • Loading branch information
tbrkollar authored Aug 5, 2024
1 parent 9a12110 commit ed938c9
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 16 deletions.
7 changes: 7 additions & 0 deletions cypress/e2e/theme/theme.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,11 @@ describe('Check theme functionality', () => {
cy.rendererApi(rendApi.id.setDarkTheme, 'false')
cy.get('body').should('have.class', 'body--light')
})
it('Zigbee mode', () => {
cy.fixture('data').then((data) => {
cy.get('#Back').click()
cy.wait(500)
cy.get('#zcl-advanced-platform').contains(data.mode)
})
})
})
3 changes: 2 additions & 1 deletion cypress/fixtures/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@
"int8clusterpath": "0",
"booleanclusterpath": "0",
"booleaninputpath": "15",
"bitmapinputpath": "16"
"bitmapinputpath": "16",
"mode": "zigbee"
}
3 changes: 2 additions & 1 deletion cypress/matterFixtures/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@
"int8clusterpath": "0",
"booleanclusterpath": "0",
"booleaninputpath": "1",
"bitmapinputpath": "1"
"bitmapinputpath": "1",
"mode": "matter"
}
1 change: 1 addition & 0 deletions src/components/ZCLToolbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
icon="arrow_back_ios"
to="/"
label="Back"
id="Back"
color="grey"
data-test="go-back-button"
/>
Expand Down
30 changes: 16 additions & 14 deletions src/pages/ZapConfig.vue
Original file line number Diff line number Diff line change
Expand Up @@ -688,42 +688,44 @@ export default {
this.filePath = result.data.filePath
this.open = result.data.open
this.currentZapFilePackages = result.data.zapFilePackages
let currentZapFileZclPacakges = []
let currentTopLevelZapFilePacakges = []
let currentZapFileTemplatePacakges = []
let currentZapFileZclPackages = []
let currentTopLevelZapFilePackages = []
let currentZapFileTemplatePackages = []
let currentZclPackagesAbsolutePaths = []
let currentTemplatePackagesAbsolutePaths = []
if (this.currentZapFilePackages) {
currentTopLevelZapFilePacakges = this.currentZapFilePackages.filter(
currentTopLevelZapFilePackages = this.currentZapFilePackages.filter(
(zfp) => zfp.type != dbEnum.packageType.zclXmlStandalone
)
currentZapFileZclPacakges = this.currentZapFilePackages.filter(
currentZapFileZclPackages = this.currentZapFilePackages.filter(
(zfp) => zfp.type == dbEnum.packageType.zclProperties
)
currentZapFileTemplatePacakges = this.currentZapFilePackages.filter(
currentZapFileTemplatePackages = this.currentZapFilePackages.filter(
(zfp) => zfp.type == dbEnum.packageType.genTemplatesJson
)
currentZclPackagesAbsolutePaths = currentZapFileZclPacakges.map((zfp) =>
currentZclPackagesAbsolutePaths = currentZapFileZclPackages.map((zfp) =>
this.createAbsolutePath(this.filePath, zfp.path)
)
currentTemplatePackagesAbsolutePaths =
currentZapFileTemplatePacakges.map((zfp) =>
currentZapFileTemplatePackages.map((zfp) =>
this.createAbsolutePath(this.filePath, zfp.path)
)
}
if (
this.zclPropertiesRow.length == currentZapFileZclPacakges.length ||
this.zclPropertiesRow.length == currentZapFileZclPackages.length ||
this.zclPropertiesRow.length == 1
) {
// We shortcut this page, if the number of packages in the zap file
// and the number of packages loaded in the backend are the same.
if (this.zclGenRow.length == currentZapFileTemplatePacakges.length) {
if (
this.zclGenRow.length == currentZapFileTemplatePackages.length ||
this.zclGenRow.length == 1
) {
this.selectedZclGenData = this.zclGenRow.map((zgr) => zgr.id)
this.selectedZclPropertiesDataIds = this.zclPropertiesRow.map(
(zpr) => zpr.id
)
this.selectedZclPropertiesData = this.zclPropertiesRow
this.selectedZclGenData = this.zclGenRow.map((zgr) => zgr.id)
}
this.customConfig = 'select'
this.submitForm()
Expand All @@ -748,7 +750,7 @@ export default {
this.selectedZclGenData.length > 0 &&
this.selectedZclPropertiesData.length +
this.selectedZclGenData.length ==
currentTopLevelZapFilePacakges.length
currentTopLevelZapFilePackages.length
) {
this.submitForm()
}
Expand Down

0 comments on commit ed938c9

Please sign in to comment.