Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

UXPLATFORM-6962: Node 16 upgrade #298

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
lts/fermium
lts/gallium
Binary file added cerner-webpack-config-terra-1.3.1.tgz
Binary file not shown.
18 changes: 14 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.1.0",
"description": "terra-graphs",
"engines": {
"node": "^10.0.0 || ^12.0.0 || ^14.0.0"
"node": "^10.0.0 || ^12.0.0 || ^14.0.0 || ^16.0.0"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -47,7 +47,7 @@
"@cerner/terra-enzyme-intl": "4.6.0",
"@cerner/terra-functional-testing": "^2.0.0",
"@cerner/terra-open-source-scripts": "^1.0.1",
"@cerner/webpack-config-terra": "^1.3.1",
"@cerner/webpack-config-terra": "file:cerner-webpack-config-terra-1.3.1.tgz",
"autoprefixer": "^9.8.6",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.1.0",
Expand All @@ -70,7 +70,7 @@
"eslint-config-prettier": "^6.11.0",
"eslint-config-standard": "^14.1.1",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jsdoc": "^24.0.6",
"eslint-plugin-jsdoc": "^30.7.6",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
Expand Down Expand Up @@ -144,6 +144,16 @@
"wdio-default": "terra wdio",
"wdio-lowlight": "NODE_OPTIONS=--max-old-space-size=2048 terra wdio --themes clinical-lowlight-theme",
"wdio-fusion": "terra wdio --themes orion-fusion-theme",
"wdio": "terra wdio --themes terra-default-theme"
"wdio": "terra wdio --themes terra-default-theme",
"wdio:bar": "terra wdio --themes terra-default-theme --spec packages/terra-graphs/tests/wdio/Graphs/BarGraph/bar-graph-spec.js",
"wdio:bubble": "terra wdio --themes terra-default-theme --spec packages/terra-graphs/tests/wdio/Graphs/BubbleGraph/bubbleGraphs-spec.js",
"wdio:combination": "terra wdio --themes terra-default-theme --spec packages/terra-graphs/tests/wdio/Graphs/CombinationGraph/combination-graph-spec.js",
"wdio:gantt": "terra wdio --themes terra-default-theme --spec packages/terra-graphs/tests/wdio/Graphs/GanttChart/gantt-chart-spec.js",
"wdio:general": "terra wdio --themes terra-default-theme --spec packages/terra-graphs/tests/wdio/Graphs/General/general-spec.js",
"wdio:line": "terra wdio --themes terra-default-theme --spec packages/terra-graphs/tests/wdio/Graphs/LineGraph/line-graph-spec.js",
"wdio:pairedresult": "terra wdio --themes terra-default-theme --spec packages/terra-graphs/tests/wdio/Graphs/PairedResultGraph/paired-result-graph-spec.js",
"wdio:pie": "terra wdio --themes terra-default-theme --spec packages/terra-graphs/tests/wdio/Graphs/PieChart/pie-graph-spec.js",
"wdio:scatter": "terra wdio --themes terra-default-theme --spec packages/terra-graphs/tests/wdio/Graphs/ScatterGraph/scatter-graph-spec.js",
"wdio:timeline": "terra wdio --themes terra-default-theme --spec packages/terra-graphs/tests/wdio/Graphs/Timeline/timeline-spec.js"
}
}
6 changes: 6 additions & 0 deletions packages/carbon-graphs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@

## Unreleased

## 2.23.0 - (January 3, 2023)

* Added
* Added logic to increase legend icon size when an icon is used in the legend without a line.

## 2.22.0 - (September 13, 2022)

* Added
* Added support for `config.axis.x.allowCalibration` for a line graph with a numerical and timeseries x-axis.
* Added support for `config.axis.x.allowCalibration` for a paired result graph with a numerical and timeseries x-axis.
* Added support for `config.axis.x.allowCalibration` for a scatter graph with a numerical and timeseries x-axis.
* Added support for `config.axis.x.allowCalibration` for a bar graph with a numerical and timeseries x-axis.
* Removed extra done() from testing as karma will fail in future

## 2.21.0 - (February 15, 2022)

Expand Down
2 changes: 1 addition & 1 deletion packages/carbon-graphs/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@cerner/carbon-graphs",
"main": "lib/Graphs.js",
"version": "2.22.0",
"version": "2.23.0",
"description": "A graphing library built using d3 based on Cerner design standards",
"repository": {
"type": "git",
Expand Down
23 changes: 11 additions & 12 deletions packages/carbon-graphs/src/js/helpers/legend.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ const legendDisplayStyle = (input) => (input.legendOptions
*/
const createLegendIcon = (buttonPath, input) => buttonPath.append(() => new Shape(getShapeForTarget(input)).getShapeElement(
getDefaultSVGProps({
svgClassNames: styles.legendItemIcon,
svgClassNames: (input.legendOptions && input.legendOptions.showLine)
? styles.legendItemIconWithLine
: styles.legendItemIcon,
svgStyles: `fill: ${getColorForTarget(input)};`,
}),
true,
Expand All @@ -75,14 +77,13 @@ const createLegendIcon = (buttonPath, input) => buttonPath.append(() => new Shap
*
* @private
* @param {object} buttonPath - d3 svg object
* @param {object} t - input item object processed from the input JSON
* @param {object} input - input item object processed from the input JSON
*/
const createLegendLine = (buttonPath, t) => {
const { legendOptions } = t;
const createLegendLine = (buttonPath, input) => {
const svg = buttonPath
.append('svg')
.classed(
legendOptions.showShape
input.legendOptions.showShape
? styles.legendItemLineWithIcon
: styles.legendItemLine,
true,
Expand All @@ -94,16 +95,16 @@ const createLegendLine = (buttonPath, t) => {
.attr('x1', 1)
.attr(
'x2',
legendOptions.showShape
input.legendOptions.showShape
? constants.DEFAULT_LEGEND_LINE_WIDTH_WITH_SYMBOL - 1
: constants.DEFAULT_LEGEND_LINE_WIDTH - 1,
)
.attr('y1', constants.LEGEND_LINE_POSITION)
.attr('y2', constants.LEGEND_LINE_POSITION)
.attr(
'style',
`stroke: ${getColorForTarget(t)};
stroke-dasharray: ${legendOptions.style.strokeDashArray};
`stroke: ${getColorForTarget(input)};
stroke-dasharray: ${input.legendOptions.style.strokeDashArray};
stroke-width: 1px;`,
);
};
Expand All @@ -117,10 +118,8 @@ const createLegendLine = (buttonPath, t) => {
const processLegendOptions = (buttonPath, input) => {
if (input.legendOptions) {
// Create a legend icon only if the showShape is true
if (input.showShapes || input.showShapes === undefined) {
if (input.legendOptions.showShape) {
createLegendIcon(buttonPath, input);
}
if ((input.showShapes || input.showShapes === undefined) && input.legendOptions.showShape) {
createLegendIcon(buttonPath, input);
}
if (input.legendOptions.showLine) {
createLegendLine(buttonPath, input);
Expand Down
1 change: 1 addition & 0 deletions packages/carbon-graphs/src/js/helpers/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export default {
legendItem: 'carbon-legend-item',
legendItemBtn: 'carbon-legend-item-btn',
legendItemIcon: 'carbon-legend-item-icon',
legendItemIconWithLine: 'carbon-legend-item-icon-with-line',
legendItemLine: 'carbon-legend-item-line',
legendItemLineWithIcon: 'carbon-legend-item-line-with-icon',
legendItemSpan: 'carbon-legend-item-span',
Expand Down
15 changes: 15 additions & 0 deletions packages/carbon-graphs/src/less/core.less
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ svg:not(:root) {
}

.carbon-svg-icon {

width: 0.625rem;
height: 0.625rem;
display: inline-block;
Expand Down Expand Up @@ -151,8 +152,20 @@ svg:not(:root) {
}
}

// refers to the icon itself IF there is no line next to it
& .carbon-legend-item-icon {
display: block;
height: 0.857rem;
width: 0.857rem;
stroke: @white;
stroke-width: 5px;
}

// refers to the icon IF there is a line next to it
& .carbon-legend-item-icon-with-line {
display: block;
height: 0.625rem;
width: 0.625rem;
stroke: @white;
stroke-width: 5px;
}
Expand All @@ -164,12 +177,14 @@ svg:not(:root) {
align-items: center;
}

// refers to the line itself IF there is no icon next to it
& .carbon-legend-item-line {
height: 5px;
width: 28px;
padding-top: 1px;
}

// refers to the line IF there is an icon next to it
& .carbon-legend-item-line-with-icon {
height: 5px;
width: 18px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ describe('Grouped Bar', () => {
.querySelector(`.${styles.taskBar}`)
.getAttribute('aria-hidden'),
).toBe('true');
done();
});
triggerEvent(legendItem[1], 'click', () => {
fetchAllElementsByClass(
Expand All @@ -161,8 +160,8 @@ describe('Grouped Bar', () => {
expect(barsContainer[0].getAttribute('aria-hidden')).toBe(
'true',
);
done();
});
done();
});
it('Displays Bar content on double click', (done) => {
const legendItem = fetchAllElementsByClass(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,14 @@ describe('Stacked Bar', () => {
.querySelector(`.${styles.taskBar}`)
.getAttribute('aria-hidden'),
).toBe('true');
done();
});
triggerEvent(legendItem[1], 'click', () => {
barsContainer;
expect(barsContainer[0].getAttribute('aria-hidden')).toBe(
'true',
);
done();
});
done();
});
it('Displays Bar content on double click', (done) => {
const legendItem = fetchAllElementsByClass(
Expand Down
16 changes: 4 additions & 12 deletions packages/carbon-graphs/tests/unit/controls/Graph/GraphAxes-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2624,7 +2624,6 @@ describe('Graph - Axes', () => {
expect(
onClickPrimaryFunctionSpy.calledOnce,
).toBeFalsy();
done();
},
);
triggerEvent(
Expand All @@ -2634,7 +2633,6 @@ describe('Graph - Axes', () => {
expect(
onClickPrimaryFunctionSpy.calledOnce,
).toBeFalsy();
done();
},
);
triggerEvent(
Expand All @@ -2644,9 +2642,9 @@ describe('Graph - Axes', () => {
expect(
onClickPrimaryFunctionSpy.calledOnce,
).toBeFalsy();
done();
},
);
done();
});
});
describe('when small label and onLabelClick function is provided', () => {
Expand All @@ -2667,7 +2665,6 @@ describe('Graph - Axes', () => {
expect(
onClickPrimaryFunctionSpy.calledOnce,
).toBeFalsy();
done();
},
);
triggerEvent(
Expand All @@ -2677,7 +2674,6 @@ describe('Graph - Axes', () => {
expect(
onClickPrimaryFunctionSpy.calledOnce,
).toBeFalsy();
done();
},
);
triggerEvent(
Expand All @@ -2687,9 +2683,9 @@ describe('Graph - Axes', () => {
expect(
onClickPrimaryFunctionSpy.calledOnce,
).toBeFalsy();
done();
},
);
done();
});
});
describe('when large label and onLabelClick function is provided', () => {
Expand All @@ -2716,7 +2712,6 @@ describe('Graph - Axes', () => {
expect(
onClickSecondaryFunctionSpy.getCall(0).args[0],
).toBe(largeLabel);
done();
},
);
triggerEvent(
Expand All @@ -2729,7 +2724,6 @@ describe('Graph - Axes', () => {
expect(
onClickFourthFunctionSpy.getCall(0).args[0],
).toBe(largeLabel);
done();
},
);
triggerEvent(
Expand All @@ -2740,9 +2734,9 @@ describe('Graph - Axes', () => {
expect(onClickThirdFunctionSpy.getCall(0).args[0]).toBe(
largeLabel,
);
done();
},
);
done();
});
});
describe('when large label is provided and onLabelClick function is not provided', () => {
Expand Down Expand Up @@ -2770,7 +2764,6 @@ describe('Graph - Axes', () => {
expect(
onClickSecondaryFunctionSpy.getCall(0).args[0],
).toBe(largeLabel);
done();
},
);
d3.select(fetchElementByClass(`${styles.axisLabelY} text`)).on(
Expand All @@ -2787,7 +2780,6 @@ describe('Graph - Axes', () => {
expect(
onClickSecondaryFunctionSpy.getCall(0).args[0],
).toBe(largeLabel);
done();
},
);
d3.select(fetchElementByClass(`${styles.axisLabelY2} text`)).on(
Expand All @@ -2804,9 +2796,9 @@ describe('Graph - Axes', () => {
expect(
onClickSecondaryFunctionSpy.getCall(0).args[0],
).toBe(largeLabel);
done();
},
);
done();
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1104,7 +1104,7 @@ describe('Line - Load', () => {
expect(iconPath.getAttribute('d')).not.toBeNull();
});
describe('when showShapes is true', () => {
it('loads shape and line if user sets showLine to be true and showShape to be true', () => {
it('loads shape and line if user sets showLine to be true and showShape to be true', () => {
const input = getInput(valuesDefault, false, false);
input.legendOptions = {
showShape: true,
Expand All @@ -1121,7 +1121,7 @@ describe('Line - Load', () => {
expect(SVGElements.length).toBe(2);

expect(iconSVG).not.toBeNull();
expect(iconSVG.classList).toContain(styles.legendItemIcon);
expect(iconSVG.classList).toContain(styles.legendItemIconWithLine);
expect(iconPath).not.toBeNull();
expect(iconPath.getAttribute('d')).not.toBeNull();

Expand Down Expand Up @@ -1154,7 +1154,7 @@ describe('Line - Load', () => {
expect(SVGElements.length).toBe(2);

expect(iconSVG).not.toBeNull();
expect(iconSVG.classList).toContain(styles.legendItemIcon);
expect(iconSVG.classList).toContain(styles.legendItemIconWithLine);
expect(iconPath).not.toBeNull();
expect(iconPath.getAttribute('d')).not.toBeNull();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1533,7 +1533,7 @@ describe('Paired Result - Load', () => {
const lineSVG = svgElements[1];
expect(svgElements.length).toBe(2);
expect(iconSVG).not.toBeNull();
expect(iconSVG.classList).toContain(styles.legendItemIcon);
expect(iconSVG.classList).toContain(styles.legendItemIconWithLine);
expect(lineSVG).not.toBeNull();
expect(lineSVG.classList).toContain(
styles.legendItemLineWithIcon,
Expand Down
Loading