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: use Toolbar and ToolbarSidebar from analytics #2358

Merged
merged 27 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
0a99e59
feat: use Toolbar and ToolbarSidebar from analytics
HendrikThePendric May 30, 2023
1f4b244
feat: use UpdateButton and HoverMenubar from analytics
HendrikThePendric May 30, 2023
cf026e3
feat: update download menu to use hovermenu components from analytics
HendrikThePendric May 30, 2023
51135b8
feat: use hover menu components from analytics for options menu
HendrikThePendric May 30, 2023
05f8ae1
feat: use interpretations button from analytics
HendrikThePendric May 30, 2023
53951fd
chore: update pot file
HendrikThePendric May 30, 2023
3fc8863
chore: upgrade @dhis2/analytics to latest
HendrikThePendric Jun 20, 2023
cd0614e
chore: fix typo in component name
HendrikThePendric Jun 20, 2023
2191f3c
fix: adjust e2e element slectors
HendrikThePendric Jun 22, 2023
72a97e9
chore: fix missing and redundant imports
HendrikThePendric Jun 22, 2023
a2c29ed
chore: fix odd linter error which only fires on ci
HendrikThePendric Jun 22, 2023
1d5d8cd
fix: adjust data test name
HendrikThePendric Jun 22, 2023
c4ef597
chore: fix lines e2e test
HendrikThePendric Jun 22, 2023
a0aeadb
fix: adjust closeFileMenuWithClick command
HendrikThePendric Jun 22, 2023
3fab280
chore: fix failing legens e2e test
HendrikThePendric Jun 22, 2023
ad2b972
chore: fix legend e2e test even better
HendrikThePendric Jun 22, 2023
c956c6c
chore: fix scatter e2e
HendrikThePendric Jun 22, 2023
e2653ef
chore: fix icon e2e
HendrikThePendric Jun 22, 2023
ea64563
chore: fix start e2e
HendrikThePendric Jun 22, 2023
506153b
chore: clean up unused imports
HendrikThePendric Jun 22, 2023
b5e9b94
fix: remove divider from plain data source submenu
HendrikThePendric Jun 22, 2023
fa76f45
chore: upgrade @dhis2/analytics to get toolbar UI improvements
HendrikThePendric Jun 27, 2023
a4cf574
fix: tweak viz type selector styles to match toolbar
HendrikThePendric Jun 27, 2023
3e96e34
chore: remove yarn start command which was only used for development
HendrikThePendric Jun 27, 2023
89f9932
chore: upgrade analytics to get decreased padding
HendrikThePendric Jun 28, 2023
9e044c1
fix: ensure `MenuSectionHeader` is `dense` when in `HoverMenuBar`
HendrikThePendric Jul 3, 2023
6913f7c
Merge branch 'dev' into DHIS2-15167-DV-toolbar-update
janhenrikoverland Aug 9, 2023
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
11 changes: 4 additions & 7 deletions cypress/elements/fileMenu/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { clickMenuBarFileButton } from '../menuBar.js'
import { clickMenuBarFileButton, menubarEl } from '../menuBar.js'

const deleteModalEl = 'file-menu-delete-modal'
const fileMenuContainerEl = 'file-menu-container'
const fileMenuToggleEl = 'file-menu-toggle'
const fileMenuToggleLayerEl = 'file-menu-toggle-layer'

export const FILE_MENU_BUTTON_NEW = 'New'
export const FILE_MENU_BUTTON_OPEN = 'Open…'
Expand All @@ -16,12 +14,11 @@ export const FILE_MENU_BUTTON_SHARE = 'Share…'
export const FILE_MENU_BUTTON_GETLINK = 'Get link…'
export const FILE_MENU_BUTTON_DELETE = 'Delete'

export const closeFileMenuWithClick = () =>
cy.getBySel(fileMenuToggleLayerEl).click('topLeft')
export const closeFileMenuWithClick = () => cy.get('body').click()

export const closeFileMenuWithEsc = () =>
cy.getBySel(fileMenuToggleEl).type('{esc}', { force: true })
// use force as the element that's being typed into is hidden
// use force as the element that's being typed into is hidden
cy.getBySel(menubarEl).contains('File').type('{esc}', { force: true })

export const clickFileMenuButton = (buttonName) =>
cy.getBySel(fileMenuContainerEl).contains(buttonName).click()
Expand Down
12 changes: 9 additions & 3 deletions cypress/elements/menuBar.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const menubarEl = 'app-menubar'
export const menubarEl = 'dhis2-analytics-hovermenubar'
const updateButton = 'app-menubar-update-button'
const optionsButton = 'app-menubar-options-button'

Expand All @@ -7,5 +7,11 @@ export const clickMenuBarUpdateButton = () => cy.getBySel(updateButton).click()
export const clickMenuBarFileButton = () =>
cy.getBySel(menubarEl).contains('File').click()

export const clickMenuBarOptionsButton = () =>
cy.getBySel(optionsButton).click()
export function clickMenuBarOptionsButton() {
return cy.getBySel(optionsButton).click()
}

export const openOptionsModal = (section = 'Data') => {
clickMenuBarOptionsButton()
return cy.getBySel('options-menu-list').contains(section).click()
}
23 changes: 8 additions & 15 deletions cypress/integration/options/axes.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
clickDimensionModalUpdateButton,
} from '../../elements/dimensionModal/index.js'
import { openDimension } from '../../elements/dimensionsPanel.js'
import { clickMenuBarOptionsButton } from '../../elements/menuBar.js'
import { openOptionsModal } from '../../elements/menuBar.js'
import {
clickOptionsModalUpdateButton,
clickOptionsTab,
Expand Down Expand Up @@ -57,8 +57,7 @@ describe('Options - Vertical axis', () => {
})
describe('title', () => {
it('opens Options -> Axes', () => {
clickMenuBarOptionsButton()
clickOptionsTab(OPTIONS_TAB_AXES)
openOptionsModal(OPTIONS_TAB_AXES)
})
it("sets axis title to 'Custom'", () => {
setAxisTitleTextModeTo('Custom')
Expand All @@ -76,8 +75,7 @@ describe('Options - Vertical axis', () => {
})
describe('range', () => {
it('opens Options -> Axes', () => {
clickMenuBarOptionsButton()
clickOptionsTab(OPTIONS_TAB_AXES)
openOptionsModal(OPTIONS_TAB_AXES)
})
it('sets min value', () => {
setAxisRangeMinValue(TEST_AXIS, TEST_MIN_VALUE)
Expand Down Expand Up @@ -111,8 +109,7 @@ describe('Options - Vertical axis', () => {
})
describe('options modal keeps changes when reopening', () => {
it('opens Options -> Axes', () => {
clickMenuBarOptionsButton()
clickOptionsTab(OPTIONS_TAB_AXES)
openOptionsModal(OPTIONS_TAB_AXES)
})
it(`title is "${TEST_TITLE}"`, () => {
expectAxisTitleToBeValue(TEST_AXIS, TEST_TITLE)
Expand Down Expand Up @@ -141,8 +138,7 @@ describe('Options - Horizontal axis', () => {
})
describe('title', () => {
it('opens Options -> Axes', () => {
clickMenuBarOptionsButton()
clickOptionsTab(OPTIONS_TAB_AXES)
openOptionsModal(OPTIONS_TAB_AXES)
})
it(`switches to '${TEST_TAB}' tab`, () => {
switchAxesTabTo(TEST_TAB)
Expand All @@ -163,8 +159,7 @@ describe('Options - Horizontal axis', () => {
})
describe('options modal keeps changes when reopening', () => {
it('opens Options -> Axes', () => {
clickMenuBarOptionsButton()
clickOptionsTab(OPTIONS_TAB_AXES)
openOptionsModal(OPTIONS_TAB_AXES)
})
it(`switches to '${TEST_TAB}' tab`, () => {
switchAxesTabTo(TEST_TAB)
Expand All @@ -185,8 +180,7 @@ describe('Options - Auto-generated axis title', () => {
})
describe('Single item - single axis', () => {
it('opens Options -> Axes', () => {
clickMenuBarOptionsButton()
clickOptionsTab(OPTIONS_TAB_AXES)
openOptionsModal(OPTIONS_TAB_AXES)
})
it("sets axis title to 'Auto generated'", () => {
setAxisTitleTextModeTo('Auto generated')
Expand Down Expand Up @@ -238,8 +232,7 @@ describe('Options - Auto-generated axis title', () => {
expectVisualizationToBeVisible(VIS_TYPE_COLUMN)
})
it('opens Options -> Series', () => {
clickMenuBarOptionsButton()
clickOptionsTab(OPTIONS_TAB_SERIES)
openOptionsModal(OPTIONS_TAB_SERIES)
})
it('enables multi axis', () => {
setItemToAxis(1, 2)
Expand Down
30 changes: 10 additions & 20 deletions cypress/integration/options/fontStyles.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ import {
clickDimensionModalUpdateButton,
} from '../../elements/dimensionModal/index.js'
import { openDimension } from '../../elements/dimensionsPanel.js'
import { clickMenuBarOptionsButton } from '../../elements/menuBar.js'
import { openOptionsModal } from '../../elements/menuBar.js'
import {
changeFontSizeOption,
clickOptionsModalUpdateButton,
clickOptionsTab,
changeTextAlignOption,
clickBoldButton,
clickItalicButton,
Expand Down Expand Up @@ -129,8 +128,7 @@ describe('Options - Font styles', () => {
expectWindowConfigTitleToBeValue(CONFIG_DEFAULT_TITLE)
})
it('opens Options -> Style', () => {
clickMenuBarOptionsButton()
clickOptionsTab(OPTIONS_TAB_STYLE)
openOptionsModal(OPTIONS_TAB_STYLE)
})
setFontStyleOptions({
fontSize: TEST_FONT_SIZE_OPTION.input,
Expand Down Expand Up @@ -174,8 +172,7 @@ describe('Options - Font styles', () => {
expectWindowConfigSubtitleToBeValue(CONFIG_DEFAULT_SUBTITLE)
})
it('opens Options -> Style', () => {
clickMenuBarOptionsButton()
clickOptionsTab(OPTIONS_TAB_STYLE)
openOptionsModal(OPTIONS_TAB_STYLE)
})
it('sets a custom subtitle', () => {
setCustomSubtitle(TEST_SUBTITLE_TEXT)
Expand Down Expand Up @@ -220,8 +217,7 @@ describe('Options - Font styles', () => {
const prefix = TARGET_LINE_PREFIX

it('opens Options -> Data', () => {
clickMenuBarOptionsButton()
clickOptionsTab(OPTIONS_TAB_DATA)
openOptionsModal(OPTIONS_TAB_DATA)
})
it('sets target line', () => {
cy.log(`Test value: ${TEST_VALUE}`)
Expand Down Expand Up @@ -280,8 +276,7 @@ describe('Options - Font styles', () => {
const prefix = BASE_LINE_PREFIX

it('opens Options -> Data', () => {
clickMenuBarOptionsButton()
clickOptionsTab(OPTIONS_TAB_DATA)
openOptionsModal(OPTIONS_TAB_DATA)
})
it('sets base line', () => {
cy.log(`Test value: ${TEST_VALUE}`)
Expand Down Expand Up @@ -338,8 +333,7 @@ describe('Options - Font styles', () => {
const prefix = SERIES_KEY_PREFIX

it('opens Options -> Style', () => {
clickMenuBarOptionsButton()
clickOptionsTab(OPTIONS_TAB_STYLE)
openOptionsModal(OPTIONS_TAB_STYLE)
})
setFontStyleOptions({
fontSize: TEST_FONT_SIZE_OPTION.input,
Expand Down Expand Up @@ -375,8 +369,7 @@ describe('Options - Font styles', () => {
const prefix = VERTICAL_AXIS_LABELS_PREFIX

it('opens Options -> Axes', () => {
clickMenuBarOptionsButton()
clickOptionsTab(OPTIONS_TAB_AXES)
openOptionsModal(OPTIONS_TAB_AXES)
})
setFontStyleOptions({
fontSize: TEST_FONT_SIZE_OPTION.input,
Expand Down Expand Up @@ -410,8 +403,7 @@ describe('Options - Font styles', () => {
const prefix = HORIZONTAL_AXIS_LABELS_PREFIX

it('opens Options -> Axes', () => {
clickMenuBarOptionsButton()
clickOptionsTab(OPTIONS_TAB_AXES)
openOptionsModal(OPTIONS_TAB_AXES)
switchAxesTabTo('Horizontal (x) axis')
})
setFontStyleOptions({
Expand Down Expand Up @@ -451,8 +443,7 @@ describe('Options - Font styles', () => {
const prefix = HORIZONTAL_AXIS_TITLE_PREFIX

it('opens Options -> Axes', () => {
clickMenuBarOptionsButton()
clickOptionsTab(OPTIONS_TAB_AXES)
openOptionsModal(OPTIONS_TAB_AXES)
})
it(`sets horizontal axis title to "${TEST_TITLE}"`, () => {
switchAxesTabTo('Horizontal (x) axis')
Expand Down Expand Up @@ -500,8 +491,7 @@ describe('Options - Font styles', () => {
const prefix = VERTICAL_AXIS_TITLE_PREFIX

it('opens Options -> Axes', () => {
clickMenuBarOptionsButton()
clickOptionsTab(OPTIONS_TAB_AXES)
openOptionsModal(OPTIONS_TAB_AXES)
})
it(`sets vertical axis title to "${TEST_TITLE}"`, () => {
setAxisTitleTextModeTo('Custom')
Expand Down
11 changes: 4 additions & 7 deletions cypress/integration/options/icon.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
unselectAllItemsByButton,
} from '../../elements/dimensionModal/index.js'
import { openDimension } from '../../elements/dimensionsPanel.js'
import { clickMenuBarOptionsButton } from '../../elements/menuBar.js'
import { openOptionsModal } from '../../elements/menuBar.js'
import {
OPTIONS_TAB_LEGEND,
OPTIONS_TAB_STYLE,
Expand Down Expand Up @@ -97,8 +97,7 @@ describe('Icon', () => {
TEST_TYPES.forEach((type) => {
it(`icon shows when option is enabled for ${type}`, () => {
// enable the icon
clickMenuBarOptionsButton()
clickOptionsTab(OPTIONS_TAB_STYLE)
openOptionsModal(OPTIONS_TAB_STYLE)
clickCheckbox('option-show-data-item-icon')
clickOptionsModalHideButton()

Expand Down Expand Up @@ -129,8 +128,7 @@ describe('Icon', () => {
// TODO: Skipped because of the same reason as the commented out tests above
it.skip('icon gets correct color when a legend is in use', () => {
// enable the icon
clickMenuBarOptionsButton()
clickOptionsTab(OPTIONS_TAB_STYLE)
openOptionsModal(OPTIONS_TAB_STYLE)
clickCheckbox('option-show-data-item-icon')

// enable the legend
Expand Down Expand Up @@ -176,8 +174,7 @@ describe('Icon', () => {
expectSingleValueToHaveIconColor('#ffffff')

// switch to apply legend color to text
clickMenuBarOptionsButton()
clickOptionsTab(OPTIONS_TAB_LEGEND)
openOptionsModal(OPTIONS_TAB_LEGEND)
changeDisplayStyleToText()
clickOptionsModalUpdateButton()

Expand Down
Loading
Loading