fix: front end CI tests and test runner (#10897)

This commit is contained in:
Elizabeth Thompson 2020-09-16 11:35:18 -07:00 committed by GitHub
parent c3f1720456
commit 13cc1a3d2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 17 deletions

View File

@ -33,7 +33,6 @@ jobs:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Install dependencies - name: Install dependencies
- name: npm install
working-directory: ./superset-frontend working-directory: ./superset-frontend
run: | run: |
npm install npm install

View File

@ -37,21 +37,29 @@ export default function getComponentWidthFromDrop({
return component.meta.width; return component.meta.width;
} }
const draggingWidth = getDetailedComponentWidth({ const {
width: draggingWidth,
minimumWidth: minDraggingWidth,
} = getDetailedComponentWidth({
component, component,
components, components,
}); });
const destinationWidth = getDetailedComponentWidth({ const {
width: destinationWidth,
occupiedWidth: draggingOccupiedWidth,
} = getDetailedComponentWidth({
id: destination.id, id: destination.id,
components, components,
}); });
let destinationCapacity = let destinationCapacity = Number(destinationWidth - draggingOccupiedWidth);
destinationWidth.width - destinationWidth.occupiedWidth;
if (Number.isNaN(destinationCapacity)) { if (Number.isNaN(destinationCapacity)) {
const grandparentWidth = getDetailedComponentWidth({ const {
width: grandparentWidth,
occupiedWidth: grandparentOccupiedWidth,
} = getDetailedComponentWidth({
id: findParentId({ id: findParentId({
childId: destination.id, childId: destination.id,
layout: components, layout: components,
@ -59,17 +67,19 @@ export default function getComponentWidthFromDrop({
components, components,
}); });
destinationCapacity = destinationCapacity = Number(grandparentWidth - grandparentOccupiedWidth);
grandparentWidth.width - grandparentWidth.occupiedWidth;
} }
if (Number.isNaN(destinationCapacity) || Number.isNaN(draggingWidth.width)) { if (
return draggingWidth.width; Number.isNaN(destinationCapacity) ||
Number.isNaN(Number(draggingWidth))
) {
return draggingWidth;
} }
if (destinationCapacity >= draggingWidth.width) { if (destinationCapacity >= draggingWidth) {
return draggingWidth.width; return draggingWidth;
} }
if (destinationCapacity >= draggingWidth.minimumWidth) { if (destinationCapacity >= minDraggingWidth) {
return destinationCapacity; return destinationCapacity;
} }

View File

@ -67,10 +67,10 @@ export default class BoundsControl extends React.Component {
onChange() { onChange() {
const mm = this.state.minMax; const mm = this.state.minMax;
const errors = []; const errors = [];
if (mm[0] && Number.isNaN(mm[0])) { if (mm[0] && Number.isNaN(Number(mm[0]))) {
errors.push(t('`Min` value should be numeric or empty')); errors.push(t('`Min` value should be numeric or empty'));
} }
if (mm[1] && Number.isNaN(mm[1])) { if (mm[1] && Number.isNaN(Number(mm[1]))) {
errors.push(t('`Max` value should be numeric or empty')); errors.push(t('`Max` value should be numeric or empty'));
} }
if (errors.length === 0) { if (errors.length === 0) {

View File

@ -116,9 +116,9 @@ export default class FilterBoxItemControl extends React.Component {
if (type === 'BOOLEAN') { if (type === 'BOOLEAN') {
typedValue = value === 'true'; typedValue = value === 'true';
} else if (INTEGRAL_TYPES.has(type)) { } else if (INTEGRAL_TYPES.has(type)) {
typedValue = Number.isNaN(value) ? null : parseInt(value, 10); typedValue = Number.isNaN(Number(value)) ? null : parseInt(value, 10);
} else if (DECIMAL_TYPES.has(type)) { } else if (DECIMAL_TYPES.has(type)) {
typedValue = Number.isNaN(value) ? null : parseFloat(value); typedValue = Number.isNaN(Number(value)) ? null : parseFloat(value);
} }
} }
} }