Skip to content

Commit

Permalink
Upgrade dependencies (#21)
Browse files Browse the repository at this point in the history
* Update dependencies

* Update sourceApiVersion

* Fix prettier
  • Loading branch information
scolladon authored Oct 9, 2020
1 parent d2688f0 commit 0c0967c
Show file tree
Hide file tree
Showing 15 changed files with 9,950 additions and 6,951 deletions.
8 changes: 4 additions & 4 deletions __tests__/__utils__/testAttributeHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { randomBytes } from 'crypto';

Object.defineProperty(global.self, 'crypto', {
value: {
getRandomValues: arr => randomBytes(arr.length)
getRandomValues: (arr) => randomBytes(arr.length)
}
});

Expand Down Expand Up @@ -54,13 +54,13 @@ function testChartOptions(
) {
describe.each(listChartOptionMock)(
'Exposed property matches ChartJS option',
item => {
(item) => {
test(`${item.propertyName}`, async () => {
const element = createElement('x-test', { is: constructor });
document.body.appendChild(element);

let detail;
document.body.addEventListener(eventName, evt => {
document.body.addEventListener(eventName, (evt) => {
detail = evt.detail;
});

Expand All @@ -81,5 +81,5 @@ global.testAttribute = (constructor, listChartOptionMock, eventName) => {

global.flushPromises = () => {
// eslint-disable-next-line no-undef
return new Promise(resolve => setImmediate(resolve));
return new Promise((resolve) => setImmediate(resolve));
};
10 changes: 5 additions & 5 deletions __tests__/unit/chart.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ describe('Chart: ChartJs library', () => {
});

// TODO: For each type of Chart: test that can be created, that contains canvas and that elements can be inserted
describe.each(CHARTS)('DOM Tests for individual charts', chart => {
describe.each(CHARTS)('DOM Tests for individual charts', (chart) => {
const chartName = chart.class.prototype.constructor.name;
const element = createElement('x-chart', {
is: chart.class
Expand Down Expand Up @@ -129,7 +129,7 @@ const TEST_DATA_PROPERTIES = [
describe('Chart: property', () => {
const element = createElement('x-chart', { is: Chart });
document.body.appendChild(element);
describe.each(TEST_DATA_PROPERTIES)('matches options', item => {
describe.each(TEST_DATA_PROPERTIES)('matches options', (item) => {
test(`${item.propertyName}`, async () => {
element[item.propertyName] = item.propertyValue;

Expand Down Expand Up @@ -250,7 +250,7 @@ describe('Chart: methods', () => {
});
test('getElementAtEventChart', async () => {
let el = null;
chart.canvasOnclick = evt => {
chart.canvasOnclick = (evt) => {
el = chart.getElementAtEventChart(evt);
};
const canvas = chart.shadowRoot.querySelector('canvas');
Expand All @@ -261,7 +261,7 @@ describe('Chart: methods', () => {
});
test('getElementsAtEventChart', async () => {
let el = null;
chart.canvasOnclick = evt => {
chart.canvasOnclick = (evt) => {
el = chart.getElementsAtEventChart(evt);
};
const canvas = chart.shadowRoot.querySelector('canvas');
Expand All @@ -272,7 +272,7 @@ describe('Chart: methods', () => {
});
test('getDatasetAtEventChart', async () => {
let el = null;
chart.canvasOnclick = evt => {
chart.canvasOnclick = (evt) => {
el = chart.getDatasetAtEventChart(evt);
};
const canvas = chart.shadowRoot.querySelector('canvas');
Expand Down
11 changes: 6 additions & 5 deletions force-app/main/default/lwc/chart/chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,9 @@ export default class Chart extends LightningElement {
}

get chartStyle() {
return `width: ${this.width}; height: ${this.height}; ${this.stylecss ||
''}`;
return `width: ${this.width}; height: ${this.height}; ${
this.stylecss || ''
}`;
}

ariaLabel;
Expand Down Expand Up @@ -342,7 +343,7 @@ export default class Chart extends LightningElement {
this._callChartjsloadedCallback();
this._reactivityManager.throttleRegisteredJob();
},
reason => {
(reason) => {
this.errorCallback(reason);
}
);
Expand Down Expand Up @@ -414,7 +415,7 @@ export default class Chart extends LightningElement {

_listenerHandlers = {
// store option and throttle a drawChart
handleOption: evt => {
handleOption: (evt) => {
evt.stopPropagation();
const { payload, option } = evt.detail;
if (option === ATTRIBUTE_DATA) {
Expand All @@ -429,7 +430,7 @@ export default class Chart extends LightningElement {
this._reactivityManager.throttleRegisteredJob();
},
// remove option and throttle a drawChart
handleDisconnect: evt => {
handleDisconnect: (evt) => {
evt.stopPropagation();
const { payload, option } = evt.detail;
if (option === ATTRIBUTE_DATA) {
Expand Down
4 changes: 1 addition & 3 deletions force-app/main/default/lwc/chartBuilder/chartBuilder.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@
<h3 class="slds-text-heading_medium slds-text-color_error">
{error}
</h3>
<p class="slds-text-body_regular">
{stack}
</p>
<p class="slds-text-body_regular">{stack}</p>
</div>
</div>
</template>
Expand Down
9 changes: 5 additions & 4 deletions force-app/main/default/lwc/chartBuilder/chartBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export default class ChartBuilder extends LightningElement {
// and create data component in the template
const palette = ChartBuilder.DEFAULT_PALETTE[this.colorPalette];
this.dimensionsLabels = this.dimensionsLabels || [
...new Set(data.map(x => x.labels).flat())
...new Set(data.map((x) => x.labels).flat())
];
this._details = data.map((x, i) => ({
detail: x.detail,
Expand All @@ -102,7 +102,7 @@ export default class ChartBuilder extends LightningElement {
}));
this.error = false;
})
.catch(error => this.errorCallback(error));
.catch((error) => this.errorCallback(error));
} catch (error) {
this.errorCallback(error);
}
Expand Down Expand Up @@ -176,10 +176,11 @@ export default class ChartBuilder extends LightningElement {
_getChartDataHandler(handlerName, input) {
this.isLoaded = false;
getChartData({ chartDataProviderType: handlerName, ctx: input })
.then(result => {
.then((result) => {
// eslint-disable-next-line @lwc/lwc/no-api-reassignments
this.details = result;
})
.catch(error => {
.catch((error) => {
this.errorCallback(error.body.message);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default class ChartConfigService {
};
} else {
this._config[option] = this._config[option] || {};
Object.keys(payload).forEach(attribut => {
Object.keys(payload).forEach((attribut) => {
// If the attribut is an array
if (Array.isArray(this._config[option][attribut])) {
if (Array.isArray(payload[attribut])) {
Expand Down Expand Up @@ -72,10 +72,10 @@ export default class ChartConfigService {
// In the scales case we need to remove the uuid related to the scale object
if (option === ATTRIBUTE_CARTESIAN_AXES) {
Object.keys(this._config[option])
.filter(scale => this._config[option][scale])
.forEach(scale => {
.filter((scale) => this._config[option][scale])
.forEach((scale) => {
this._config[option][scale] = this._config[option][scale].filter(
axis => axis.uuid !== payload[scale][0].uuid
(axis) => axis.uuid !== payload[scale][0].uuid
);
this._scales[scale] = this._config[option][scale];
});
Expand All @@ -100,16 +100,16 @@ export default class ChartConfigService {
// - undefined attribute
// do it recursively and store the result to avoid multiple times the same computation
static cleanObject(obj) {
const validObj = o =>
const validObj = (o) =>
(Object.keys(o).length || (Array.isArray(o) && o.length)) && o;
const itemToBool = item => {
const itemToBool = (item) => {
return typeof item !== 'object' || item === null
? item
: // eslint-disable-next-line no-use-before-define
validObj(clean(item));
};

const clean = o =>
const clean = (o) =>
validObj(
Array.isArray(o)
? o.map(itemToBool).filter(Boolean)
Expand Down
4 changes: 2 additions & 2 deletions force-app/main/default/lwc/dataset/dataset.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ export default class Dataset extends BaseAttribute {

_listenerHandlers = {
// Capture child data event and store it using the uuid of the child
handleDataChange: evt => {
handleDataChange: (evt) => {
evt.stopPropagation();
this._details[evt.detail.payload.uuid] = evt.detail.payload;
this._payload.datasets = Object.values(this._details);
},

// Capture child diqconnect event and remove child uuid from map
handleDataDeletion: evt => {
handleDataDeletion: (evt) => {
evt.stopPropagation();
delete this._details[evt.detail.payload.uuid];
this._payload.datasets = Object.values(this._details);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ describe('c-sample-app-item', () => {
'button.slds-button.slds-button_neutral'
)
];
buttons.forEach(button => button.click());
buttons.reverse().forEach(button => button.click());
buttons.forEach((button) => button.click());
buttons.reverse().forEach((button) => button.click());
})
.then(() => {
// Verify that property is correctly incremented.
Expand Down
2 changes: 1 addition & 1 deletion force-app/sample/default/lwc/sampleApp/sampleApp.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</div>

<!-- Samples -->
<div class="container" style="text-align: center;">
<div class="container" style="text-align: center">
<!--
<c-sample-app-item>
<c-chart slot="chartExample" type="bar" responsive="true">
Expand Down
6 changes: 3 additions & 3 deletions force-app/sample/default/lwc/sampleApp/sampleApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ export default class SampleApp extends LightningElement {
this.filterTypes = [
...new Set(
[...this.template.querySelectorAll('c-chart')].map(
chart => chart.type
(chart) => chart.type
)
)
];
}
}

displayAllCharts() {
this.template.querySelectorAll('c-chart').forEach(item => {
this.template.querySelectorAll('c-chart').forEach((item) => {
item.closest('c-sample-app-item').classList.remove('slds-hide');
});
}

displayFilteredCharts(event) {
this.template.querySelectorAll('c-chart').forEach(item => {
this.template.querySelectorAll('c-chart').forEach((item) => {
const parent = item.closest('c-sample-app-item');
if (!parent) return;
if (item.type.toUpperCase() === event.target.innerText) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@
</footer>
</div>
</section>
<div class="slds-backdrop slds-backdrop_open" style="opacity: 1.0"></div>
<div class="slds-backdrop slds-backdrop_open" style="opacity: 1"></div>
</template>
</template>
Loading

0 comments on commit 0c0967c

Please sign in to comment.