Skip to content

Commit e84a027

Browse files
feat: support non-gregorian fixed periods (#2233)
* feat: support non-gregorian fixed periods * test: fix test failing due to change in single value behaviour --------- Co-authored-by: Jan Henrik Øverland <[email protected]>
1 parent d05b902 commit e84a027

File tree

5 files changed

+63
-14
lines changed

5 files changed

+63
-14
lines changed

cypress/elements/optionsModal/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ export {
7676
changeDisplayStyleToText,
7777
expectLegendDisplayStyleToBeText,
7878
expectLegendDisplayStyleToBeFill,
79-
expectSingleValueToNotBeColor,
79+
expectSingleValueToHaveBackgroundColor,
80+
expectSingleValueToNotHaveBackgroundColor,
8081
expectSingleValueToBeColor,
8182
toggleLegendKeyOption,
8283
expectLegendKeyOptionToBeEnabled,

cypress/elements/optionsModal/legend.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const legendKeyOptionEl = 'option-legend-key'
33
const legendKeyEl = 'visualization-legend-key'
44
const legendKeyContainerEl = 'legend-key-container'
55
const legendKeyItemEl = 'legend-key-item'
6+
const visualizationContainerEl = 'visualization-container'
67
const singleValueOutputEl = 'visualization-primary-value'
78
const legendDisplayStrategyByDataItemEl = 'legend-display-strategy-BY_DATA_ITEM'
89
const legendDisplayStrategyFixedEl = 'legend-display-strategy-FIXED'
@@ -64,11 +65,17 @@ export const changeFixedLegendSet = (legendSetName) => {
6465
export const expectFixedLegendSetToBe = (legendSetName) =>
6566
cy.getBySel(fixedLegendSetSelectEl).should('contain', legendSetName)
6667

67-
export const expectSingleValueToNotBeColor = (color) =>
68+
export const expectSingleValueToHaveBackgroundColor = (color) =>
6869
cy
69-
.getBySel(singleValueOutputEl)
70-
.invoke('attr', 'fill')
71-
.should('not.eq', color)
70+
.getBySel(visualizationContainerEl)
71+
.parent()
72+
.should('have.css', 'background-color', color)
73+
74+
export const expectSingleValueToNotHaveBackgroundColor = (color) =>
75+
cy
76+
.getBySel(visualizationContainerEl)
77+
.parent()
78+
.should('not.have.css', 'background-color', color)
7279

7380
export const expectSingleValueToBeColor = (color) =>
7481
cy.getBySel(singleValueOutputEl).invoke('attr', 'fill').should('eq', color)

cypress/integration/options/legend.cy.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ import {
4646
expectLegendDisplayStyleToBeText,
4747
expectLegendToBeEnabled,
4848
expectSingleValueToBeColor,
49-
expectSingleValueToNotBeColor,
49+
expectSingleValueToHaveBackgroundColor,
50+
expectSingleValueToNotHaveBackgroundColor,
5051
OPTIONS_TAB_LEGEND,
5152
toggleLegendKeyOption,
5253
expectLegendKeyOptionToBeEnabled,
@@ -152,6 +153,7 @@ describe('Options - Legend', () => {
152153
describe('Applying a legend: Single value', () => {
153154
const TEST_ITEM = TEST_ITEMS[0]
154155
const EXPECTED_STANDARD_TEXT_COLOR = '#212934'
156+
const EXPECTED_LEGEND_BACKGROUND_COLOR = 'rgb(255, 255, 178)'
155157
it('navigates to the start page and adds data items', () => {
156158
goToStartPage()
157159
changeVisType(visTypeDisplayNames[VIS_TYPE_SINGLE_VALUE])
@@ -160,6 +162,9 @@ describe('Options - Legend', () => {
160162
clickDimensionModalUpdateButton()
161163
expectVisualizationToBeVisible(VIS_TYPE_SINGLE_VALUE)
162164
expectSingleValueToBeColor(EXPECTED_STANDARD_TEXT_COLOR)
165+
expectSingleValueToNotHaveBackgroundColor(
166+
EXPECTED_LEGEND_BACKGROUND_COLOR
167+
)
163168
})
164169
it('enables legend', () => {
165170
clickMenuBarOptionsButton()
@@ -171,7 +176,9 @@ describe('Options - Legend', () => {
171176
expectVisualizationToBeVisible(VIS_TYPE_SINGLE_VALUE)
172177
})
173178
it('legend is applied', () => {
174-
expectSingleValueToNotBeColor(EXPECTED_STANDARD_TEXT_COLOR)
179+
expectSingleValueToHaveBackgroundColor(
180+
EXPECTED_LEGEND_BACKGROUND_COLOR
181+
)
175182
})
176183
it('legend key is hidden', () => {
177184
expectLegendKeyToBeHidden()
@@ -459,7 +466,7 @@ describe('Options - Legend', () => {
459466
})
460467
})
461468
describe('Transferring a legend: Column -> Single value', () => {
462-
const EXPECTED_STANDARD_TEXT_COLOR = '#212934'
469+
const EXPECTED_LEGEND_BACKGROUND_COLOR = 'rgb(255, 255, 178)'
463470
it('navigates to the start page and adds data items', () => {
464471
goToStartPage()
465472
openDimension(DIMENSION_ID_DATA)
@@ -490,7 +497,9 @@ describe('Options - Legend', () => {
490497
expectVisualizationToBeVisible(VIS_TYPE_SINGLE_VALUE)
491498
})
492499
it('legend is applied to Single value', () => {
493-
expectSingleValueToNotBeColor(EXPECTED_STANDARD_TEXT_COLOR)
500+
expectSingleValueToHaveBackgroundColor(
501+
EXPECTED_LEGEND_BACKGROUND_COLOR
502+
)
494503
})
495504
it('verifies that options are persisted', () => {
496505
clickMenuBarOptionsButton()

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"start-server-and-test": "^1.14.0"
3939
},
4040
"dependencies": {
41-
"@dhis2/analytics": "^24.4.0",
41+
"@dhis2/analytics": "^24.9.0",
4242
"@dhis2/app-runtime": "^3.7.0",
4343
"@dhis2/app-runtime-adapter-d2": "^1.1.0",
4444
"@dhis2/app-service-datastore": "^1.0.0-beta.3",

yarn.lock

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1981,12 +1981,13 @@
19811981
classnames "^2.3.1"
19821982
prop-types "^15.7.2"
19831983

1984-
"@dhis2/analytics@^24.4.0":
1985-
version "24.4.0"
1986-
resolved "https://registry.yarnpkg.com/@dhis2/analytics/-/analytics-24.4.0.tgz#99a4cc0c8d846edb9792e489db3f93357f71d8be"
1987-
integrity sha512-0tSECJLMhEvn96OLYQhfdbNoEaLN2EkXp0zc8FfjEfM7HtVjNeiops9SaQH1Fzu2/XkkY9H1lcX5PHGo4Ail9g==
1984+
"@dhis2/analytics@^24.9.0":
1985+
version "24.9.0"
1986+
resolved "https://registry.yarnpkg.com/@dhis2/analytics/-/analytics-24.9.0.tgz#cda66beb53eefd4b2c0651cf2db6e448333bf3d4"
1987+
integrity sha512-pHu+gar6QS8+uqR7/YBleeKz+1isWyaN2vl6TXiM7b8lQaWpMepmQzmn07/bZXF+ZQbYmU8flqAsNv/ibrogqg==
19881988
dependencies:
19891989
"@dhis2/d2-ui-rich-text" "^7.4.0"
1990+
"@dhis2/multi-calendar-dates" "1.0.0"
19901991
classnames "^2.3.1"
19911992
d2-utilizr "^0.2.16"
19921993
d3-color "^1.2.3"
@@ -2225,6 +2226,14 @@
22252226
markdown-it "^8.4.2"
22262227
prop-types "^15.6.2"
22272228

2229+
2230+
version "1.0.0"
2231+
resolved "https://registry.yarnpkg.com/@dhis2/multi-calendar-dates/-/multi-calendar-dates-1.0.0.tgz#bf7f49aecdffa9781837a5d60d56a094b74ab4df"
2232+
integrity sha512-IB9a+feuS6yE4lpZj/eZ9uBmpYI7Hxitl2Op0JjoRL4tP+p6uw4ns9cjoSdUeIU9sOAxVZV7oQqSyIw+9P6YjQ==
2233+
dependencies:
2234+
"@js-temporal/polyfill" "^0.4.2"
2235+
classnames "^2.3.2"
2236+
22282237
"@dhis2/prop-types@^3.1.2":
22292238
version "3.1.2"
22302239
resolved "https://registry.yarnpkg.com/@dhis2/prop-types/-/prop-types-3.1.2.tgz#65b8ad2da8cd2f72bc8b951049a6c9d1b97af3e9"
@@ -2748,6 +2757,14 @@
27482757
"@jridgewell/resolve-uri" "^3.0.3"
27492758
"@jridgewell/sourcemap-codec" "^1.4.10"
27502759

2760+
"@js-temporal/polyfill@^0.4.2":
2761+
version "0.4.3"
2762+
resolved "https://registry.yarnpkg.com/@js-temporal/polyfill/-/polyfill-0.4.3.tgz#e8f8cf86745eb5050679c46a5ebedb9a9cc1f09b"
2763+
integrity sha512-6Fmjo/HlkyVCmJzAPnvtEWlcbQUSRhi8qlN9EtJA/wP7FqXsevLLrlojR44kzNzrRkpf7eDJ+z7b4xQD/Ycypw==
2764+
dependencies:
2765+
jsbi "^4.1.0"
2766+
tslib "^2.3.1"
2767+
27512768
"@juggle/resize-observer@^3.3.1":
27522769
version "3.3.1"
27532770
resolved "https://registry.yarnpkg.com/@juggle/resize-observer/-/resize-observer-3.3.1.tgz#b50a781709c81e10701004214340f25475a171a0"
@@ -4972,6 +4989,11 @@ classnames@^2.2.6, classnames@^2.3.1:
49724989
resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.3.1.tgz#dfcfa3891e306ec1dad105d0e88f4417b8535e8e"
49734990
integrity sha512-OlQdbZ7gLfGarSqxesMesDa5uz7KFbID8Kpq/SxIoNGDqY8lSYs0D+hhtBXhcdB3rcbXArFr7vlHheLk1voeNA==
49744991

4992+
classnames@^2.3.2:
4993+
version "2.3.2"
4994+
resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.3.2.tgz#351d813bf0137fcc6a76a16b88208d2560a0d924"
4995+
integrity sha512-CSbhY4cFEJRe6/GQzIk5qXZ4Jeg5pcsP7b5peFSDpffpe1cqjASH/n9UTjBwOp6XpMSTwQ8Za2K5V02ueA7Tmw==
4996+
49754997
clean-css@^5.2.2:
49764998
version "5.3.1"
49774999
resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-5.3.1.tgz#d0610b0b90d125196a2894d35366f734e5d7aa32"
@@ -9431,6 +9453,11 @@ js-yaml@^4.1.0:
94319453
dependencies:
94329454
argparse "^2.0.1"
94339455

9456+
jsbi@^4.1.0:
9457+
version "4.3.0"
9458+
resolved "https://registry.yarnpkg.com/jsbi/-/jsbi-4.3.0.tgz#b54ee074fb6fcbc00619559305c8f7e912b04741"
9459+
integrity sha512-SnZNcinB4RIcnEyZqFPdGPVgrg2AcnykiBy0sHVJQKHYeaLUvi3Exj+iaPpLnFVkDPZIV4U0yvgC9/R4uEAZ9g==
9460+
94349461
jsbn@~0.1.0:
94359462
version "0.1.1"
94369463
resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513"
@@ -14169,6 +14196,11 @@ tslib@^2.0.1, tslib@^2.0.3, tslib@^2.1.0:
1416914196
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3"
1417014197
integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==
1417114198

14199+
tslib@^2.3.1:
14200+
version "2.5.0"
14201+
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.5.0.tgz#42bfed86f5787aeb41d031866c8f402429e0fddf"
14202+
integrity sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==
14203+
1417214204
tsutils@^3.21.0:
1417314205
version "3.21.0"
1417414206
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623"

0 commit comments

Comments
 (0)