Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support non-gregorian fixed periods #2233

Merged
merged 3 commits into from
Mar 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cypress/elements/optionsModal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ export {
changeDisplayStyleToText,
expectLegendDisplayStyleToBeText,
expectLegendDisplayStyleToBeFill,
expectSingleValueToNotBeColor,
expectSingleValueToHaveBackgroundColor,
expectSingleValueToNotHaveBackgroundColor,
expectSingleValueToBeColor,
toggleLegendKeyOption,
expectLegendKeyOptionToBeEnabled,
Expand Down
15 changes: 11 additions & 4 deletions cypress/elements/optionsModal/legend.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const legendKeyOptionEl = 'option-legend-key'
const legendKeyEl = 'visualization-legend-key'
const legendKeyContainerEl = 'legend-key-container'
const legendKeyItemEl = 'legend-key-item'
const visualizationContainerEl = 'visualization-container'
const singleValueOutputEl = 'visualization-primary-value'
const legendDisplayStrategyByDataItemEl = 'legend-display-strategy-BY_DATA_ITEM'
const legendDisplayStrategyFixedEl = 'legend-display-strategy-FIXED'
Expand Down Expand Up @@ -64,11 +65,17 @@ export const changeFixedLegendSet = (legendSetName) => {
export const expectFixedLegendSetToBe = (legendSetName) =>
cy.getBySel(fixedLegendSetSelectEl).should('contain', legendSetName)

export const expectSingleValueToNotBeColor = (color) =>
export const expectSingleValueToHaveBackgroundColor = (color) =>
cy
.getBySel(singleValueOutputEl)
.invoke('attr', 'fill')
.should('not.eq', color)
.getBySel(visualizationContainerEl)
.parent()
.should('have.css', 'background-color', color)

export const expectSingleValueToNotHaveBackgroundColor = (color) =>
cy
.getBySel(visualizationContainerEl)
.parent()
.should('not.have.css', 'background-color', color)

export const expectSingleValueToBeColor = (color) =>
cy.getBySel(singleValueOutputEl).invoke('attr', 'fill').should('eq', color)
Expand Down
17 changes: 13 additions & 4 deletions cypress/integration/options/legend.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ import {
expectLegendDisplayStyleToBeText,
expectLegendToBeEnabled,
expectSingleValueToBeColor,
expectSingleValueToNotBeColor,
expectSingleValueToHaveBackgroundColor,
expectSingleValueToNotHaveBackgroundColor,
OPTIONS_TAB_LEGEND,
toggleLegendKeyOption,
expectLegendKeyOptionToBeEnabled,
Expand Down Expand Up @@ -152,6 +153,7 @@ describe('Options - Legend', () => {
describe('Applying a legend: Single value', () => {
const TEST_ITEM = TEST_ITEMS[0]
const EXPECTED_STANDARD_TEXT_COLOR = '#212934'
const EXPECTED_LEGEND_BACKGROUND_COLOR = 'rgb(255, 255, 178)'
it('navigates to the start page and adds data items', () => {
goToStartPage()
changeVisType(visTypeDisplayNames[VIS_TYPE_SINGLE_VALUE])
Expand All @@ -160,6 +162,9 @@ describe('Options - Legend', () => {
clickDimensionModalUpdateButton()
expectVisualizationToBeVisible(VIS_TYPE_SINGLE_VALUE)
expectSingleValueToBeColor(EXPECTED_STANDARD_TEXT_COLOR)
expectSingleValueToNotHaveBackgroundColor(
EXPECTED_LEGEND_BACKGROUND_COLOR
)
})
it('enables legend', () => {
clickMenuBarOptionsButton()
Expand All @@ -171,7 +176,9 @@ describe('Options - Legend', () => {
expectVisualizationToBeVisible(VIS_TYPE_SINGLE_VALUE)
})
it('legend is applied', () => {
expectSingleValueToNotBeColor(EXPECTED_STANDARD_TEXT_COLOR)
expectSingleValueToHaveBackgroundColor(
EXPECTED_LEGEND_BACKGROUND_COLOR
)
})
it('legend key is hidden', () => {
expectLegendKeyToBeHidden()
Expand Down Expand Up @@ -459,7 +466,7 @@ describe('Options - Legend', () => {
})
})
describe('Transferring a legend: Column -> Single value', () => {
const EXPECTED_STANDARD_TEXT_COLOR = '#212934'
const EXPECTED_LEGEND_BACKGROUND_COLOR = 'rgb(255, 255, 178)'
it('navigates to the start page and adds data items', () => {
goToStartPage()
openDimension(DIMENSION_ID_DATA)
Expand Down Expand Up @@ -490,7 +497,9 @@ describe('Options - Legend', () => {
expectVisualizationToBeVisible(VIS_TYPE_SINGLE_VALUE)
})
it('legend is applied to Single value', () => {
expectSingleValueToNotBeColor(EXPECTED_STANDARD_TEXT_COLOR)
expectSingleValueToHaveBackgroundColor(
EXPECTED_LEGEND_BACKGROUND_COLOR
)
})
it('verifies that options are persisted', () => {
clickMenuBarOptionsButton()
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"start-server-and-test": "^1.14.0"
},
"dependencies": {
"@dhis2/analytics": "^24.4.0",
"@dhis2/analytics": "^24.9.0",
"@dhis2/app-runtime": "^3.7.0",
"@dhis2/app-runtime-adapter-d2": "^1.1.0",
"@dhis2/app-service-datastore": "^1.0.0-beta.3",
Expand Down
40 changes: 36 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1981,12 +1981,13 @@
classnames "^2.3.1"
prop-types "^15.7.2"

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

"@dhis2/multi-calendar-dates@1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@dhis2/multi-calendar-dates/-/multi-calendar-dates-1.0.0.tgz#bf7f49aecdffa9781837a5d60d56a094b74ab4df"
integrity sha512-IB9a+feuS6yE4lpZj/eZ9uBmpYI7Hxitl2Op0JjoRL4tP+p6uw4ns9cjoSdUeIU9sOAxVZV7oQqSyIw+9P6YjQ==
dependencies:
"@js-temporal/polyfill" "^0.4.2"
classnames "^2.3.2"

"@dhis2/prop-types@^3.1.2":
version "3.1.2"
resolved "https://registry.yarnpkg.com/@dhis2/prop-types/-/prop-types-3.1.2.tgz#65b8ad2da8cd2f72bc8b951049a6c9d1b97af3e9"
Expand Down Expand Up @@ -2748,6 +2757,14 @@
"@jridgewell/resolve-uri" "^3.0.3"
"@jridgewell/sourcemap-codec" "^1.4.10"

"@js-temporal/polyfill@^0.4.2":
version "0.4.3"
resolved "https://registry.yarnpkg.com/@js-temporal/polyfill/-/polyfill-0.4.3.tgz#e8f8cf86745eb5050679c46a5ebedb9a9cc1f09b"
integrity sha512-6Fmjo/HlkyVCmJzAPnvtEWlcbQUSRhi8qlN9EtJA/wP7FqXsevLLrlojR44kzNzrRkpf7eDJ+z7b4xQD/Ycypw==
dependencies:
jsbi "^4.1.0"
tslib "^2.3.1"

"@juggle/resize-observer@^3.3.1":
version "3.3.1"
resolved "https://registry.yarnpkg.com/@juggle/resize-observer/-/resize-observer-3.3.1.tgz#b50a781709c81e10701004214340f25475a171a0"
Expand Down Expand Up @@ -4972,6 +4989,11 @@ classnames@^2.2.6, classnames@^2.3.1:
resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.3.1.tgz#dfcfa3891e306ec1dad105d0e88f4417b8535e8e"
integrity sha512-OlQdbZ7gLfGarSqxesMesDa5uz7KFbID8Kpq/SxIoNGDqY8lSYs0D+hhtBXhcdB3rcbXArFr7vlHheLk1voeNA==

classnames@^2.3.2:
version "2.3.2"
resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.3.2.tgz#351d813bf0137fcc6a76a16b88208d2560a0d924"
integrity sha512-CSbhY4cFEJRe6/GQzIk5qXZ4Jeg5pcsP7b5peFSDpffpe1cqjASH/n9UTjBwOp6XpMSTwQ8Za2K5V02ueA7Tmw==

clean-css@^5.2.2:
version "5.3.1"
resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-5.3.1.tgz#d0610b0b90d125196a2894d35366f734e5d7aa32"
Expand Down Expand Up @@ -9431,6 +9453,11 @@ js-yaml@^4.1.0:
dependencies:
argparse "^2.0.1"

jsbi@^4.1.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/jsbi/-/jsbi-4.3.0.tgz#b54ee074fb6fcbc00619559305c8f7e912b04741"
integrity sha512-SnZNcinB4RIcnEyZqFPdGPVgrg2AcnykiBy0sHVJQKHYeaLUvi3Exj+iaPpLnFVkDPZIV4U0yvgC9/R4uEAZ9g==

jsbn@~0.1.0:
version "0.1.1"
resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513"
Expand Down Expand Up @@ -14169,6 +14196,11 @@ tslib@^2.0.1, tslib@^2.0.3, tslib@^2.1.0:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3"
integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==

tslib@^2.3.1:
version "2.5.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.5.0.tgz#42bfed86f5787aeb41d031866c8f402429e0fddf"
integrity sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==

tsutils@^3.21.0:
version "3.21.0"
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623"
Expand Down