Skip to content

Commit ed938c9

Browse files
authored
fix: add extra parameter to condition and fix spelling errors in ZapConfig(#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
1 parent 9a12110 commit ed938c9

File tree

5 files changed

+28
-16
lines changed

5 files changed

+28
-16
lines changed

cypress/e2e/theme/theme.cy.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,11 @@ describe('Check theme functionality', () => {
4040
cy.rendererApi(rendApi.id.setDarkTheme, 'false')
4141
cy.get('body').should('have.class', 'body--light')
4242
})
43+
it('Zigbee mode', () => {
44+
cy.fixture('data').then((data) => {
45+
cy.get('#Back').click()
46+
cy.wait(500)
47+
cy.get('#zcl-advanced-platform').contains(data.mode)
48+
})
49+
})
4350
})

cypress/fixtures/data.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,6 @@
3232
"int8clusterpath": "0",
3333
"booleanclusterpath": "0",
3434
"booleaninputpath": "15",
35-
"bitmapinputpath": "16"
35+
"bitmapinputpath": "16",
36+
"mode": "zigbee"
3637
}

cypress/matterFixtures/data.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,6 @@
3232
"int8clusterpath": "0",
3333
"booleanclusterpath": "0",
3434
"booleaninputpath": "1",
35-
"bitmapinputpath": "1"
35+
"bitmapinputpath": "1",
36+
"mode": "matter"
3637
}

src/components/ZCLToolbar.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
icon="arrow_back_ios"
3232
to="/"
3333
label="Back"
34+
id="Back"
3435
color="grey"
3536
data-test="go-back-button"
3637
/>

src/pages/ZapConfig.vue

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -688,42 +688,44 @@ export default {
688688
this.filePath = result.data.filePath
689689
this.open = result.data.open
690690
this.currentZapFilePackages = result.data.zapFilePackages
691-
let currentZapFileZclPacakges = []
692-
let currentTopLevelZapFilePacakges = []
693-
let currentZapFileTemplatePacakges = []
691+
let currentZapFileZclPackages = []
692+
let currentTopLevelZapFilePackages = []
693+
let currentZapFileTemplatePackages = []
694694
let currentZclPackagesAbsolutePaths = []
695695
let currentTemplatePackagesAbsolutePaths = []
696696
if (this.currentZapFilePackages) {
697-
currentTopLevelZapFilePacakges = this.currentZapFilePackages.filter(
697+
currentTopLevelZapFilePackages = this.currentZapFilePackages.filter(
698698
(zfp) => zfp.type != dbEnum.packageType.zclXmlStandalone
699699
)
700-
currentZapFileZclPacakges = this.currentZapFilePackages.filter(
700+
currentZapFileZclPackages = this.currentZapFilePackages.filter(
701701
(zfp) => zfp.type == dbEnum.packageType.zclProperties
702702
)
703-
currentZapFileTemplatePacakges = this.currentZapFilePackages.filter(
703+
704+
currentZapFileTemplatePackages = this.currentZapFilePackages.filter(
704705
(zfp) => zfp.type == dbEnum.packageType.genTemplatesJson
705706
)
706-
currentZclPackagesAbsolutePaths = currentZapFileZclPacakges.map((zfp) =>
707+
currentZclPackagesAbsolutePaths = currentZapFileZclPackages.map((zfp) =>
707708
this.createAbsolutePath(this.filePath, zfp.path)
708709
)
709710
currentTemplatePackagesAbsolutePaths =
710-
currentZapFileTemplatePacakges.map((zfp) =>
711+
currentZapFileTemplatePackages.map((zfp) =>
711712
this.createAbsolutePath(this.filePath, zfp.path)
712713
)
713714
}
714715
715716
if (
716-
this.zclPropertiesRow.length == currentZapFileZclPacakges.length ||
717+
this.zclPropertiesRow.length == currentZapFileZclPackages.length ||
717718
this.zclPropertiesRow.length == 1
718719
) {
719-
// We shortcut this page, if the number of packages in the zap file
720-
// and the number of packages loaded in the backend are the same.
721-
if (this.zclGenRow.length == currentZapFileTemplatePacakges.length) {
720+
if (
721+
this.zclGenRow.length == currentZapFileTemplatePackages.length ||
722+
this.zclGenRow.length == 1
723+
) {
724+
this.selectedZclGenData = this.zclGenRow.map((zgr) => zgr.id)
722725
this.selectedZclPropertiesDataIds = this.zclPropertiesRow.map(
723726
(zpr) => zpr.id
724727
)
725728
this.selectedZclPropertiesData = this.zclPropertiesRow
726-
this.selectedZclGenData = this.zclGenRow.map((zgr) => zgr.id)
727729
}
728730
this.customConfig = 'select'
729731
this.submitForm()
@@ -748,7 +750,7 @@ export default {
748750
this.selectedZclGenData.length > 0 &&
749751
this.selectedZclPropertiesData.length +
750752
this.selectedZclGenData.length ==
751-
currentTopLevelZapFilePacakges.length
753+
currentTopLevelZapFilePackages.length
752754
) {
753755
this.submitForm()
754756
}

0 commit comments

Comments
 (0)