@pie-lib/graphing 4.0.4 → 4.0.5-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_rolldown/runtime.js +23 -0
- package/dist/axis/arrow.d.ts +13 -0
- package/dist/axis/arrow.js +34 -0
- package/dist/axis/axes.d.ts +132 -0
- package/dist/axis/axes.js +214 -0
- package/dist/axis/index.d.ts +10 -0
- package/dist/bg.d.ts +51 -0
- package/dist/bg.js +44 -0
- package/dist/container/actions.d.ts +15 -0
- package/dist/container/actions.js +7 -0
- package/dist/container/index.d.ts +26 -0
- package/dist/container/index.js +50 -0
- package/dist/container/marks.d.ts +10 -0
- package/dist/container/marks.js +11 -0
- package/dist/container/middleware.d.ts +10 -0
- package/dist/container/middleware.js +4 -0
- package/dist/container/reducer.d.ts +12 -0
- package/dist/container/reducer.js +7 -0
- package/dist/coordinates-label.d.ts +50 -0
- package/dist/coordinates-label.js +46 -0
- package/dist/graph-with-controls.d.ts +88 -0
- package/dist/graph-with-controls.js +154 -0
- package/dist/graph.d.ts +126 -0
- package/dist/graph.js +209 -0
- package/dist/grid-setup.d.ts +27 -0
- package/dist/grid-setup.js +307 -0
- package/dist/grid.d.ts +43 -0
- package/dist/grid.js +59 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +7 -0
- package/dist/key-legend.d.ts +21 -0
- package/dist/key-legend.js +231 -0
- package/dist/label-svg-icon.d.ts +18 -0
- package/dist/label-svg-icon.js +42 -0
- package/dist/labels.d.ts +37 -0
- package/dist/labels.js +152 -0
- package/dist/mark-label.d.ts +58 -0
- package/dist/mark-label.js +172 -0
- package/dist/node_modules/.bun/@babel_runtime@7.29.7/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js +7 -0
- package/dist/node_modules/.bun/@babel_runtime@7.29.7/node_modules/@babel/runtime/helpers/esm/defineProperty.js +12 -0
- package/dist/node_modules/.bun/@babel_runtime@7.29.7/node_modules/@babel/runtime/helpers/esm/extends.js +12 -0
- package/dist/node_modules/.bun/@babel_runtime@7.29.7/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +7 -0
- package/dist/node_modules/.bun/@babel_runtime@7.29.7/node_modules/@babel/runtime/helpers/esm/objectSpread2.js +25 -0
- package/dist/node_modules/.bun/@babel_runtime@7.29.7/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +12 -0
- package/dist/node_modules/.bun/@babel_runtime@7.29.7/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +8 -0
- package/dist/node_modules/.bun/@babel_runtime@7.29.7/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +14 -0
- package/dist/node_modules/.bun/@babel_runtime@7.29.7/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js +9 -0
- package/dist/node_modules/.bun/@babel_runtime@7.29.7/node_modules/@babel/runtime/helpers/esm/typeof.js +11 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/Axis.js +100 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/AxisRenderer.js +61 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/axis/Ticks.js +42 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/constants/orientation.js +9 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/createPoint.js +14 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/getAxisRangePaddingConfig.js +21 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/getLabelTransform.js +16 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/getTickFormatter.js +8 -0
- package/dist/node_modules/.bun/@visx_axis@3.12.0_f4eacebf2041cd4f/node_modules/@visx/axis/esm/utils/getTickPosition.js +15 -0
- package/dist/node_modules/.bun/@visx_curve@3.12.0/node_modules/@visx/curve/esm/index.js +2 -0
- package/dist/node_modules/.bun/@visx_grid@3.12.0_f4eacebf2041cd4f/node_modules/@visx/grid/esm/grids/Grid.js +78 -0
- package/dist/node_modules/.bun/@visx_grid@3.12.0_f4eacebf2041cd4f/node_modules/@visx/grid/esm/grids/GridColumns.js +79 -0
- package/dist/node_modules/.bun/@visx_grid@3.12.0_f4eacebf2041cd4f/node_modules/@visx/grid/esm/grids/GridRows.js +79 -0
- package/dist/node_modules/.bun/@visx_grid@3.12.0_f4eacebf2041cd4f/node_modules/@visx/grid/esm/utils/getScaleBandwidth.js +6 -0
- package/dist/node_modules/.bun/@visx_group@3.12.0_f4eacebf2041cd4f/node_modules/@visx/group/esm/Group.js +49 -0
- package/dist/node_modules/.bun/@visx_point@3.12.0/node_modules/@visx/point/esm/Point.js +18 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/utils/coerceNumber.js +10 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/utils/getTicks.js +9 -0
- package/dist/node_modules/.bun/@visx_scale@3.12.0/node_modules/@visx/scale/esm/utils/toString.js +6 -0
- package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/esm/shapes/Line.js +46 -0
- package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/esm/shapes/LinePath.js +49 -0
- package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/esm/util/D3ShapeFactories.js +9 -0
- package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/esm/util/setNumberOrNumberAccessor.js +6 -0
- package/dist/node_modules/.bun/@visx_shape@3.12.0_f4eacebf2041cd4f/node_modules/@visx/shape/lib/shapes/Line.js +52 -0
- package/dist/node_modules/.bun/@visx_text@3.12.0_f4eacebf2041cd4f/node_modules/@visx/text/esm/Text.js +57 -0
- package/dist/node_modules/.bun/@visx_text@3.12.0_f4eacebf2041cd4f/node_modules/@visx/text/esm/hooks/useText.js +91 -0
- package/dist/node_modules/.bun/@visx_text@3.12.0_f4eacebf2041cd4f/node_modules/@visx/text/esm/util/getStringWidth.js +21 -0
- package/dist/node_modules/.bun/balanced-match@0.4.2/node_modules/balanced-match/index.js +32 -0
- package/dist/node_modules/.bun/balanced-match@1.0.2/node_modules/balanced-match/index.js +33 -0
- package/dist/node_modules/.bun/hoist-non-react-statics@3.3.2/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js +68 -0
- package/dist/node_modules/.bun/invariant@2.2.4/node_modules/invariant/browser.js +28 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_Hash.js +21 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_ListCache.js +21 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_Map.js +10 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_MapCache.js +21 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_Symbol.js +9 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_assocIndexOf.js +14 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_baseGetTag.js +15 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_baseIsNative.js +16 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_coreJsData.js +9 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_freeGlobal.js +8 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_getMapData.js +14 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_getNative.js +15 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_getRawTag.js +19 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_getValue.js +11 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_hashClear.js +13 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_hashDelete.js +12 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_hashGet.js +18 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_hashHas.js +14 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_hashSet.js +14 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_isKeyable.js +12 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_isMasked.js +16 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_listCacheClear.js +11 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_listCacheDelete.js +14 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_listCacheGet.js +14 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_listCacheHas.js +13 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_listCacheSet.js +14 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_mapCacheClear.js +19 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_mapCacheDelete.js +14 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_mapCacheGet.js +13 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_mapCacheHas.js +13 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_mapCacheSet.js +14 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_nativeCreate.js +9 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_objectToString.js +12 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_root.js +10 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/_toSource.js +20 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/eq.js +11 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/isFunction.js +16 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/isObject.js +12 -0
- package/dist/node_modules/.bun/lodash@4.18.1/node_modules/lodash/memoize.js +20 -0
- package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/formula_evaluator.js +37 -0
- package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/lexer.js +509 -0
- package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/math_function.js +108 -0
- package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/postfix.js +31 -0
- package/dist/node_modules/.bun/math-expression-evaluator@1.4.0/node_modules/math-expression-evaluator/src/postfix_evaluator.js +45 -0
- package/dist/node_modules/.bun/react-input-autosize@2.2.2_f4eacebf2041cd4f/node_modules/react-input-autosize/lib/AutosizeInput.js +216 -0
- package/dist/node_modules/.bun/react-is@16.13.1/node_modules/react-is/cjs/react-is.development.js +82 -0
- package/dist/node_modules/.bun/react-is@16.13.1/node_modules/react-is/cjs/react-is.production.min.js +62 -0
- package/dist/node_modules/.bun/react-is@16.13.1/node_modules/react-is/index.js +10 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/components/Context.js +5 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/components/Provider.js +47 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/components/connectAdvanced.js +95 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/connect/connect.js +52 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/connect/mapDispatchToProps.js +23 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/connect/mapStateToProps.js +13 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/connect/mergeProps.js +26 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/connect/selectorFactory.js +41 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/connect/verifySubselectors.js +11 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/connect/wrapMapToProps.js +28 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/index.js +4 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/utils/isPlainObject.js +10 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/utils/shallowEqual.js +15 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/utils/verifyPlainObject.js +8 -0
- package/dist/node_modules/.bun/react-redux@6.0.1_926323a638b43722/node_modules/react-redux/es/utils/warning.js +9 -0
- package/dist/node_modules/.bun/reduce-css-calc@1.3.0/node_modules/reduce-css-calc/index.js +49 -0
- package/dist/node_modules/.bun/reduce-function-call@1.0.3/node_modules/reduce-function-call/index.js +34 -0
- package/dist/node_modules/.bun/redux-undo@1.1.0/node_modules/redux-undo/dist/redux-undo.js +185 -0
- package/dist/node_modules/.bun/redux@4.2.1/node_modules/redux/es/redux.js +225 -0
- package/dist/toggle-bar.d.ts +40 -0
- package/dist/toggle-bar.js +155 -0
- package/dist/tool-menu.d.ts +29 -0
- package/dist/tool-menu.js +41 -0
- package/dist/tools/absolute/component.d.ts +16 -0
- package/dist/tools/absolute/component.js +15 -0
- package/dist/tools/absolute/index.d.ts +20 -0
- package/dist/tools/absolute/index.js +32 -0
- package/dist/tools/circle/bg-circle.d.ts +116 -0
- package/dist/tools/circle/bg-circle.js +72 -0
- package/dist/tools/circle/component.d.ts +83 -0
- package/dist/tools/circle/component.js +195 -0
- package/dist/tools/circle/index.d.ts +20 -0
- package/dist/tools/circle/index.js +22 -0
- package/dist/tools/exponential/component.d.ts +16 -0
- package/dist/tools/exponential/component.js +14 -0
- package/dist/tools/exponential/index.d.ts +20 -0
- package/dist/tools/exponential/index.js +32 -0
- package/dist/tools/index.d.ts +27 -0
- package/dist/tools/index.js +55 -0
- package/dist/tools/line/component.d.ts +124 -0
- package/dist/tools/line/component.js +72 -0
- package/dist/tools/line/index.d.ts +13 -0
- package/dist/tools/line/index.js +6 -0
- package/dist/tools/parabola/component.d.ts +16 -0
- package/dist/tools/parabola/component.js +14 -0
- package/dist/tools/parabola/index.d.ts +20 -0
- package/dist/tools/parabola/index.js +32 -0
- package/dist/tools/point/component.d.ts +50 -0
- package/dist/tools/point/component.js +85 -0
- package/dist/tools/point/index.d.ts +15 -0
- package/dist/tools/point/index.js +13 -0
- package/dist/tools/polygon/component.d.ts +117 -0
- package/dist/tools/polygon/component.js +262 -0
- package/dist/tools/polygon/index.d.ts +19 -0
- package/dist/tools/polygon/index.js +55 -0
- package/dist/tools/polygon/line.d.ts +125 -0
- package/dist/tools/polygon/line.js +63 -0
- package/dist/tools/polygon/polygon.d.ts +122 -0
- package/dist/tools/polygon/polygon.js +74 -0
- package/dist/tools/ray/component.d.ts +101 -0
- package/dist/tools/ray/component.js +71 -0
- package/dist/tools/ray/index.d.ts +13 -0
- package/dist/tools/ray/index.js +6 -0
- package/dist/tools/segment/component.d.ts +100 -0
- package/dist/tools/segment/component.js +52 -0
- package/dist/tools/segment/index.d.ts +13 -0
- package/dist/tools/segment/index.js +6 -0
- package/dist/tools/shared/arrow-head.d.ts +51 -0
- package/dist/tools/shared/arrow-head.js +63 -0
- package/dist/tools/shared/icons/CorrectSVG.d.ts +26 -0
- package/dist/tools/shared/icons/CorrectSVG.js +29 -0
- package/dist/tools/shared/icons/IncorrectSVG.d.ts +26 -0
- package/dist/tools/shared/icons/IncorrectSVG.js +27 -0
- package/dist/tools/shared/icons/MissingSVG.d.ts +26 -0
- package/dist/tools/shared/icons/MissingSVG.js +28 -0
- package/dist/tools/shared/line/index.d.ts +245 -0
- package/dist/tools/shared/line/index.js +319 -0
- package/dist/tools/shared/line/line-path.d.ts +57 -0
- package/dist/tools/shared/line/line-path.js +71 -0
- package/dist/tools/shared/line/with-root-edge.d.ts +142 -0
- package/dist/tools/shared/line/with-root-edge.js +73 -0
- package/dist/tools/shared/point/arrow-point.d.ts +56 -0
- package/dist/tools/shared/point/arrow-point.js +41 -0
- package/dist/tools/shared/point/arrow.d.ts +45 -0
- package/dist/tools/shared/point/arrow.js +35 -0
- package/dist/tools/shared/point/base-point.d.ts +52 -0
- package/dist/tools/shared/point/base-point.js +103 -0
- package/dist/tools/shared/point/index.d.ts +216 -0
- package/dist/tools/shared/point/index.js +45 -0
- package/dist/tools/shared/styles.d.ts +29 -0
- package/dist/tools/shared/styles.js +20 -0
- package/dist/tools/shared/types.d.ts +21 -0
- package/dist/tools/shared/types.js +11 -0
- package/dist/tools/sine/component.d.ts +16 -0
- package/dist/tools/sine/component.js +22 -0
- package/dist/tools/sine/index.d.ts +20 -0
- package/dist/tools/sine/index.js +32 -0
- package/dist/tools/vector/component.d.ts +100 -0
- package/dist/tools/vector/component.js +44 -0
- package/dist/tools/vector/index.d.ts +13 -0
- package/dist/tools/vector/index.js +6 -0
- package/dist/undo-redo.d.ts +22 -0
- package/dist/undo-redo.js +47 -0
- package/dist/use-debounce.d.ts +9 -0
- package/dist/use-debounce.js +13 -0
- package/dist/utils.d.ts +61 -0
- package/dist/utils.js +75 -0
- package/package.json +35 -25
- package/CHANGELOG.json +0 -1
- package/CHANGELOG.md +0 -1469
- package/LICENSE.md +0 -5
- package/lib/axis/arrow.js +0 -79
- package/lib/axis/arrow.js.map +0 -1
- package/lib/axis/axes.js +0 -329
- package/lib/axis/axes.js.map +0 -1
- package/lib/axis/index.js +0 -21
- package/lib/axis/index.js.map +0 -1
- package/lib/bg.js +0 -114
- package/lib/bg.js.map +0 -1
- package/lib/container/actions.js +0 -18
- package/lib/container/actions.js.map +0 -1
- package/lib/container/index.js +0 -118
- package/lib/container/index.js.map +0 -1
- package/lib/container/marks.js +0 -22
- package/lib/container/marks.js.map +0 -1
- package/lib/container/middleware.js +0 -19
- package/lib/container/middleware.js.map +0 -1
- package/lib/container/reducer.js +0 -18
- package/lib/container/reducer.js.map +0 -1
- package/lib/coordinates-label.js +0 -79
- package/lib/coordinates-label.js.map +0 -1
- package/lib/graph-with-controls.js +0 -294
- package/lib/graph-with-controls.js.map +0 -1
- package/lib/graph.js +0 -327
- package/lib/graph.js.map +0 -1
- package/lib/grid-setup.js +0 -414
- package/lib/grid-setup.js.map +0 -1
- package/lib/grid.js +0 -131
- package/lib/grid.js.map +0 -1
- package/lib/index.js +0 -47
- package/lib/index.js.map +0 -1
- package/lib/key-legend.js +0 -201
- package/lib/key-legend.js.map +0 -1
- package/lib/label-svg-icon.js +0 -50
- package/lib/label-svg-icon.js.map +0 -1
- package/lib/labels.js +0 -243
- package/lib/labels.js.map +0 -1
- package/lib/mark-label.js +0 -285
- package/lib/mark-label.js.map +0 -1
- package/lib/toggle-bar.js +0 -252
- package/lib/toggle-bar.js.map +0 -1
- package/lib/tool-menu.js +0 -78
- package/lib/tool-menu.js.map +0 -1
- package/lib/tools/absolute/component.js +0 -29
- package/lib/tools/absolute/component.js.map +0 -1
- package/lib/tools/absolute/index.js +0 -50
- package/lib/tools/absolute/index.js.map +0 -1
- package/lib/tools/circle/bg-circle.js +0 -123
- package/lib/tools/circle/bg-circle.js.map +0 -1
- package/lib/tools/circle/component.js +0 -321
- package/lib/tools/circle/component.js.map +0 -1
- package/lib/tools/circle/index.js +0 -41
- package/lib/tools/circle/index.js.map +0 -1
- package/lib/tools/exponential/component.js +0 -28
- package/lib/tools/exponential/component.js.map +0 -1
- package/lib/tools/exponential/index.js +0 -56
- package/lib/tools/exponential/index.js.map +0 -1
- package/lib/tools/index.js +0 -86
- package/lib/tools/index.js.map +0 -1
- package/lib/tools/line/component.js +0 -97
- package/lib/tools/line/component.js.map +0 -1
- package/lib/tools/line/index.js +0 -11
- package/lib/tools/line/index.js.map +0 -1
- package/lib/tools/parabola/component.js +0 -28
- package/lib/tools/parabola/component.js.map +0 -1
- package/lib/tools/parabola/index.js +0 -50
- package/lib/tools/parabola/index.js.map +0 -1
- package/lib/tools/point/component.js +0 -148
- package/lib/tools/point/component.js.map +0 -1
- package/lib/tools/point/index.js +0 -24
- package/lib/tools/point/index.js.map +0 -1
- package/lib/tools/polygon/component.js +0 -437
- package/lib/tools/polygon/component.js.map +0 -1
- package/lib/tools/polygon/index.js +0 -89
- package/lib/tools/polygon/index.js.map +0 -1
- package/lib/tools/polygon/line.js +0 -112
- package/lib/tools/polygon/line.js.map +0 -1
- package/lib/tools/polygon/polygon.js +0 -130
- package/lib/tools/polygon/polygon.js.map +0 -1
- package/lib/tools/ray/component.js +0 -95
- package/lib/tools/ray/component.js.map +0 -1
- package/lib/tools/ray/index.js +0 -11
- package/lib/tools/ray/index.js.map +0 -1
- package/lib/tools/segment/component.js +0 -71
- package/lib/tools/segment/component.js.map +0 -1
- package/lib/tools/segment/index.js +0 -11
- package/lib/tools/segment/index.js.map +0 -1
- package/lib/tools/shared/arrow-head.js +0 -111
- package/lib/tools/shared/arrow-head.js.map +0 -1
- package/lib/tools/shared/icons/CorrectSVG.js +0 -40
- package/lib/tools/shared/icons/CorrectSVG.js.map +0 -1
- package/lib/tools/shared/icons/IncorrectSVG.js +0 -40
- package/lib/tools/shared/icons/IncorrectSVG.js.map +0 -1
- package/lib/tools/shared/icons/MissingSVG.js +0 -39
- package/lib/tools/shared/icons/MissingSVG.js.map +0 -1
- package/lib/tools/shared/line/index.js +0 -550
- package/lib/tools/shared/line/index.js.map +0 -1
- package/lib/tools/shared/line/line-path.js +0 -118
- package/lib/tools/shared/line/line-path.js.map +0 -1
- package/lib/tools/shared/line/with-root-edge.js +0 -121
- package/lib/tools/shared/line/with-root-edge.js.map +0 -1
- package/lib/tools/shared/point/arrow-point.js +0 -72
- package/lib/tools/shared/point/arrow-point.js.map +0 -1
- package/lib/tools/shared/point/arrow.js +0 -67
- package/lib/tools/shared/point/arrow.js.map +0 -1
- package/lib/tools/shared/point/base-point.js +0 -157
- package/lib/tools/shared/point/base-point.js.map +0 -1
- package/lib/tools/shared/point/index.js +0 -68
- package/lib/tools/shared/point/index.js.map +0 -1
- package/lib/tools/shared/styles.js +0 -33
- package/lib/tools/shared/styles.js.map +0 -1
- package/lib/tools/shared/types.js +0 -16
- package/lib/tools/shared/types.js.map +0 -1
- package/lib/tools/sine/component.js +0 -40
- package/lib/tools/sine/component.js.map +0 -1
- package/lib/tools/sine/index.js +0 -50
- package/lib/tools/sine/index.js.map +0 -1
- package/lib/tools/vector/component.js +0 -68
- package/lib/tools/vector/component.js.map +0 -1
- package/lib/tools/vector/index.js +0 -11
- package/lib/tools/vector/index.js.map +0 -1
- package/lib/undo-redo.js +0 -86
- package/lib/undo-redo.js.map +0 -1
- package/lib/use-debounce.js +0 -25
- package/lib/use-debounce.js.map +0 -1
- package/lib/utils.js +0 -229
- package/lib/utils.js.map +0 -1
- package/src/__tests__/bg.test.jsx +0 -250
- package/src/__tests__/coordinates-label.test.jsx +0 -243
- package/src/__tests__/graph-with-controls.test.jsx +0 -198
- package/src/__tests__/graph.test.jsx +0 -721
- package/src/__tests__/grid-setup.test.jsx +0 -645
- package/src/__tests__/grid.test.jsx +0 -22
- package/src/__tests__/key-legend.test.jsx +0 -260
- package/src/__tests__/label-svg-icon.test.jsx +0 -278
- package/src/__tests__/labels.test.jsx +0 -55
- package/src/__tests__/mark-label.test.jsx +0 -63
- package/src/__tests__/toggle-bar.test.jsx +0 -146
- package/src/__tests__/tool-menu.test.jsx +0 -115
- package/src/__tests__/undo-redo.test.jsx +0 -24
- package/src/__tests__/use-debounce.test.js +0 -21
- package/src/__tests__/utils.js +0 -41
- package/src/__tests__/utils.test.js +0 -105
- package/src/axis/__tests__/arrow.test.jsx +0 -38
- package/src/axis/__tests__/axes.test.jsx +0 -216
- package/src/axis/arrow.jsx +0 -57
- package/src/axis/axes.jsx +0 -285
- package/src/axis/index.js +0 -3
- package/src/bg.jsx +0 -96
- package/src/container/__tests__/actions.test.js +0 -105
- package/src/container/__tests__/index.test.jsx +0 -319
- package/src/container/__tests__/marks.test.js +0 -172
- package/src/container/__tests__/middleware.test.js +0 -235
- package/src/container/__tests__/reducer.test.js +0 -324
- package/src/container/actions.js +0 -8
- package/src/container/index.jsx +0 -83
- package/src/container/marks.js +0 -14
- package/src/container/middleware.js +0 -7
- package/src/container/reducer.js +0 -5
- package/src/coordinates-label.jsx +0 -63
- package/src/graph-with-controls.jsx +0 -239
- package/src/graph.jsx +0 -303
- package/src/grid-setup.jsx +0 -432
- package/src/grid.jsx +0 -133
- package/src/index.js +0 -7
- package/src/key-legend.jsx +0 -142
- package/src/label-svg-icon.jsx +0 -39
- package/src/labels.jsx +0 -207
- package/src/mark-label.jsx +0 -244
- package/src/toggle-bar.jsx +0 -224
- package/src/tool-menu.jsx +0 -49
- package/src/tools/absolute/__tests__/component.test.jsx +0 -53
- package/src/tools/absolute/component.jsx +0 -23
- package/src/tools/absolute/index.js +0 -31
- package/src/tools/circle/__tests__/bg-circle.test.jsx +0 -26
- package/src/tools/circle/__tests__/component.test.jsx +0 -494
- package/src/tools/circle/__tests__/index.test.js +0 -480
- package/src/tools/circle/bg-circle.jsx +0 -81
- package/src/tools/circle/component.jsx +0 -264
- package/src/tools/circle/index.js +0 -25
- package/src/tools/exponential/__tests__/component.test.jsx +0 -53
- package/src/tools/exponential/__tests__/index.test.js +0 -729
- package/src/tools/exponential/component.jsx +0 -23
- package/src/tools/exponential/index.js +0 -39
- package/src/tools/index.js +0 -48
- package/src/tools/line/__tests__/component.test.jsx +0 -37
- package/src/tools/line/component.jsx +0 -93
- package/src/tools/line/index.js +0 -4
- package/src/tools/parabola/__tests__/component.test.jsx +0 -48
- package/src/tools/parabola/__tests__/index.test.js +0 -470
- package/src/tools/parabola/component.jsx +0 -23
- package/src/tools/parabola/index.js +0 -31
- package/src/tools/point/__tests__/component.test.jsx +0 -349
- package/src/tools/point/__tests__/index.test.js +0 -241
- package/src/tools/point/component.jsx +0 -126
- package/src/tools/point/index.js +0 -11
- package/src/tools/polygon/__tests__/component.test.jsx +0 -471
- package/src/tools/polygon/__tests__/index.test.js +0 -294
- package/src/tools/polygon/__tests__/line.test.jsx +0 -35
- package/src/tools/polygon/__tests__/polygon.test.jsx +0 -61
- package/src/tools/polygon/component.jsx +0 -409
- package/src/tools/polygon/index.js +0 -52
- package/src/tools/polygon/line.jsx +0 -74
- package/src/tools/polygon/polygon.jsx +0 -110
- package/src/tools/ray/__tests__/component.test.jsx +0 -29
- package/src/tools/ray/component.jsx +0 -92
- package/src/tools/ray/index.js +0 -4
- package/src/tools/segment/__tests__/component.test.jsx +0 -28
- package/src/tools/segment/component.jsx +0 -65
- package/src/tools/segment/index.js +0 -4
- package/src/tools/shared/__tests__/arrow-head.test.jsx +0 -31
- package/src/tools/shared/arrow-head.jsx +0 -102
- package/src/tools/shared/icons/CorrectSVG.jsx +0 -32
- package/src/tools/shared/icons/IncorrectSVG.jsx +0 -30
- package/src/tools/shared/icons/MissingSVG.jsx +0 -31
- package/src/tools/shared/line/__tests__/index.test.jsx +0 -109
- package/src/tools/shared/line/__tests__/line-path.test.jsx +0 -53
- package/src/tools/shared/line/__tests__/with-root-edge.test.jsx +0 -73
- package/src/tools/shared/line/index.jsx +0 -487
- package/src/tools/shared/line/line-path.jsx +0 -80
- package/src/tools/shared/line/with-root-edge.jsx +0 -97
- package/src/tools/shared/point/__tests__/arrow-point.test.jsx +0 -91
- package/src/tools/shared/point/__tests__/base-point.test.jsx +0 -87
- package/src/tools/shared/point/arrow-point.jsx +0 -46
- package/src/tools/shared/point/arrow.jsx +0 -37
- package/src/tools/shared/point/base-point.jsx +0 -121
- package/src/tools/shared/point/index.jsx +0 -54
- package/src/tools/shared/styles.js +0 -27
- package/src/tools/shared/types.js +0 -10
- package/src/tools/sine/__tests__/component.test.jsx +0 -51
- package/src/tools/sine/component.jsx +0 -32
- package/src/tools/sine/index.js +0 -33
- package/src/tools/vector/__tests__/component.test.jsx +0 -25
- package/src/tools/vector/component.jsx +0 -56
- package/src/tools/vector/index.js +0 -4
- package/src/undo-redo.jsx +0 -45
- package/src/use-debounce.js +0 -13
- package/src/utils.js +0 -224
|
@@ -1,260 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render } from '@pie-lib/test-utils';
|
|
3
|
-
import KeyLegend from '../key-legend';
|
|
4
|
-
|
|
5
|
-
describe('KeyLegend', () => {
|
|
6
|
-
describe('rendering', () => {
|
|
7
|
-
it('renders without crashing', () => {
|
|
8
|
-
const { container } = render(<KeyLegend />);
|
|
9
|
-
expect(container).toBeTruthy();
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
it('renders the title "Key"', () => {
|
|
13
|
-
const { getByText } = render(<KeyLegend />);
|
|
14
|
-
expect(getByText('Key')).toBeTruthy();
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
it('applies custom className when provided', () => {
|
|
18
|
-
const { container } = render(<KeyLegend className="custom-class" />);
|
|
19
|
-
const mainContainer = container.firstChild;
|
|
20
|
-
expect(mainContainer).toHaveClass('custom-class');
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('renders without className', () => {
|
|
24
|
-
const { container } = render(<KeyLegend />);
|
|
25
|
-
expect(container.firstChild).toBeTruthy();
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
describe('without label support (isLabelAvailable=false)', () => {
|
|
30
|
-
it('renders Answer Key Correct row', () => {
|
|
31
|
-
const { getByText } = render(<KeyLegend isLabelAvailable={false} />);
|
|
32
|
-
expect(getByText('Answer Key Correct')).toBeTruthy();
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('renders Student Incorrect row', () => {
|
|
36
|
-
const { getByText } = render(<KeyLegend isLabelAvailable={false} />);
|
|
37
|
-
expect(getByText('Student Incorrect')).toBeTruthy();
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('does not render Missing Required Label row', () => {
|
|
41
|
-
const { queryByText } = render(<KeyLegend isLabelAvailable={false} />);
|
|
42
|
-
expect(queryByText('Missing Required Label')).toBeFalsy();
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it('does not render Answer Key Correct Label row', () => {
|
|
46
|
-
const { queryByText } = render(<KeyLegend isLabelAvailable={false} />);
|
|
47
|
-
expect(queryByText('Answer Key Correct Label')).toBeFalsy();
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it('does not render Incorrect Student Label row', () => {
|
|
51
|
-
const { queryByText } = render(<KeyLegend isLabelAvailable={false} />);
|
|
52
|
-
expect(queryByText('Incorrect Student Label')).toBeFalsy();
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it('renders exactly 2 rows (correct + incorrect)', () => {
|
|
56
|
-
const { getByText } = render(<KeyLegend isLabelAvailable={false} />);
|
|
57
|
-
// Verify the 2 text labels are present (one per row)
|
|
58
|
-
expect(getByText('Answer Key Correct')).toBeTruthy();
|
|
59
|
-
expect(getByText('Student Incorrect')).toBeTruthy();
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
describe('with label support (isLabelAvailable=true)', () => {
|
|
64
|
-
it('renders Missing Required Label row', () => {
|
|
65
|
-
const { getByText } = render(<KeyLegend isLabelAvailable={true} />);
|
|
66
|
-
expect(getByText('Missing Required Label')).toBeTruthy();
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it('renders Answer Key Correct row', () => {
|
|
70
|
-
const { getByText } = render(<KeyLegend isLabelAvailable={true} />);
|
|
71
|
-
expect(getByText('Answer Key Correct')).toBeTruthy();
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
it('renders Answer Key Correct Label row', () => {
|
|
75
|
-
const { getByText } = render(<KeyLegend isLabelAvailable={true} />);
|
|
76
|
-
expect(getByText('Answer Key Correct Label')).toBeTruthy();
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
it('renders Student Incorrect row', () => {
|
|
80
|
-
const { getByText } = render(<KeyLegend isLabelAvailable={true} />);
|
|
81
|
-
expect(getByText('Student Incorrect')).toBeTruthy();
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
it('renders Incorrect Student Label row', () => {
|
|
85
|
-
const { getByText } = render(<KeyLegend isLabelAvailable={true} />);
|
|
86
|
-
expect(getByText('Incorrect Student Label')).toBeTruthy();
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
it('renders exactly 5 rows (all legend items)', () => {
|
|
90
|
-
const { getByText } = render(<KeyLegend isLabelAvailable={true} />);
|
|
91
|
-
// Verify all 5 text labels are present (one per row)
|
|
92
|
-
expect(getByText('Missing Required Label')).toBeTruthy();
|
|
93
|
-
expect(getByText('Answer Key Correct')).toBeTruthy();
|
|
94
|
-
expect(getByText('Answer Key Correct Label')).toBeTruthy();
|
|
95
|
-
expect(getByText('Student Incorrect')).toBeTruthy();
|
|
96
|
-
expect(getByText('Incorrect Student Label')).toBeTruthy();
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
describe('default behavior', () => {
|
|
101
|
-
it('treats undefined isLabelAvailable as false', () => {
|
|
102
|
-
const { queryByText } = render(<KeyLegend />);
|
|
103
|
-
expect(queryByText('Missing Required Label')).toBeFalsy();
|
|
104
|
-
expect(queryByText('Answer Key Correct Label')).toBeFalsy();
|
|
105
|
-
expect(queryByText('Incorrect Student Label')).toBeFalsy();
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
describe('SVG icons', () => {
|
|
110
|
-
it('renders SVG for Missing Required Label', () => {
|
|
111
|
-
const { container } = render(<KeyLegend isLabelAvailable={true} />);
|
|
112
|
-
const svgs = container.querySelectorAll('svg');
|
|
113
|
-
expect(svgs.length).toBeGreaterThan(0);
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
it('renders SVG for Answer Key Correct', () => {
|
|
117
|
-
const { container } = render(<KeyLegend isLabelAvailable={false} />);
|
|
118
|
-
const svgs = container.querySelectorAll('svg');
|
|
119
|
-
expect(svgs.length).toBeGreaterThan(0);
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
it('renders SVG for Student Incorrect', () => {
|
|
123
|
-
const { container } = render(<KeyLegend isLabelAvailable={false} />);
|
|
124
|
-
const svgs = container.querySelectorAll('svg');
|
|
125
|
-
// There are 3 SVGs: 2 for rows + possibly decorative elements
|
|
126
|
-
expect(svgs.length).toBeGreaterThanOrEqual(2);
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
it('renders more SVGs when labels are available', () => {
|
|
130
|
-
const { container: withoutLabels } = render(<KeyLegend isLabelAvailable={false} />);
|
|
131
|
-
const svgsWithoutLabels = withoutLabels.querySelectorAll('svg');
|
|
132
|
-
|
|
133
|
-
const { container: withLabels } = render(<KeyLegend isLabelAvailable={true} />);
|
|
134
|
-
const svgsWithLabels = withLabels.querySelectorAll('svg');
|
|
135
|
-
|
|
136
|
-
expect(svgsWithLabels.length).toBeGreaterThan(svgsWithoutLabels.length);
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
describe('styling', () => {
|
|
141
|
-
it('applies container styles', () => {
|
|
142
|
-
const { container } = render(<KeyLegend />);
|
|
143
|
-
const mainContainer = container.firstChild;
|
|
144
|
-
|
|
145
|
-
expect(mainContainer).toHaveStyle({
|
|
146
|
-
padding: '20px',
|
|
147
|
-
width: '355px',
|
|
148
|
-
});
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
it('renders title with correct styling', () => {
|
|
152
|
-
const { getByText } = render(<KeyLegend />);
|
|
153
|
-
const title = getByText('Key');
|
|
154
|
-
|
|
155
|
-
expect(title).toHaveStyle({
|
|
156
|
-
marginLeft: '30px',
|
|
157
|
-
fontWeight: '700',
|
|
158
|
-
marginBottom: '10px',
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
describe('row structure', () => {
|
|
164
|
-
it('each row contains text and SVG', () => {
|
|
165
|
-
const { getByText, container } = render(<KeyLegend isLabelAvailable={true} />);
|
|
166
|
-
|
|
167
|
-
// Verify that text labels exist
|
|
168
|
-
expect(getByText('Missing Required Label')).toBeTruthy();
|
|
169
|
-
expect(getByText('Answer Key Correct')).toBeTruthy();
|
|
170
|
-
expect(getByText('Answer Key Correct Label')).toBeTruthy();
|
|
171
|
-
expect(getByText('Student Incorrect')).toBeTruthy();
|
|
172
|
-
expect(getByText('Incorrect Student Label')).toBeTruthy();
|
|
173
|
-
|
|
174
|
-
// Verify SVGs exist
|
|
175
|
-
const svgs = container.querySelectorAll('svg');
|
|
176
|
-
expect(svgs.length).toBeGreaterThanOrEqual(5);
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
it('displays correct text alignment', () => {
|
|
180
|
-
const { getByText } = render(<KeyLegend />);
|
|
181
|
-
const text = getByText('Answer Key Correct');
|
|
182
|
-
|
|
183
|
-
expect(text).toHaveStyle({
|
|
184
|
-
textAlign: 'right',
|
|
185
|
-
marginRight: '10px',
|
|
186
|
-
});
|
|
187
|
-
});
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
describe('accessibility', () => {
|
|
191
|
-
it('includes descriptive text for each legend item', () => {
|
|
192
|
-
const { getByText } = render(<KeyLegend isLabelAvailable={true} />);
|
|
193
|
-
|
|
194
|
-
expect(getByText('Missing Required Label')).toBeTruthy();
|
|
195
|
-
expect(getByText('Answer Key Correct')).toBeTruthy();
|
|
196
|
-
expect(getByText('Answer Key Correct Label')).toBeTruthy();
|
|
197
|
-
expect(getByText('Student Incorrect')).toBeTruthy();
|
|
198
|
-
expect(getByText('Incorrect Student Label')).toBeTruthy();
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
it('SVGs are decorative (no role or aria-label needed)', () => {
|
|
202
|
-
const { container } = render(<KeyLegend isLabelAvailable={true} />);
|
|
203
|
-
const svgs = container.querySelectorAll('svg');
|
|
204
|
-
|
|
205
|
-
svgs.forEach((svg) => {
|
|
206
|
-
// SVGs should not have interactive roles
|
|
207
|
-
expect(svg.getAttribute('role')).toBeFalsy();
|
|
208
|
-
});
|
|
209
|
-
});
|
|
210
|
-
});
|
|
211
|
-
|
|
212
|
-
describe('edge cases', () => {
|
|
213
|
-
it('handles isLabelAvailable as boolean true', () => {
|
|
214
|
-
const { queryByText } = render(<KeyLegend isLabelAvailable={true} />);
|
|
215
|
-
expect(queryByText('Missing Required Label')).toBeTruthy();
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
it('handles isLabelAvailable as boolean false', () => {
|
|
219
|
-
const { queryByText } = render(<KeyLegend isLabelAvailable={false} />);
|
|
220
|
-
expect(queryByText('Missing Required Label')).toBeFalsy();
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
it('handles isLabelAvailable as truthy value', () => {
|
|
224
|
-
const { queryByText } = render(<KeyLegend isLabelAvailable={1} />);
|
|
225
|
-
expect(queryByText('Missing Required Label')).toBeTruthy();
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
it('handles isLabelAvailable as falsy value', () => {
|
|
229
|
-
const { queryByText } = render(<KeyLegend isLabelAvailable={0} />);
|
|
230
|
-
expect(queryByText('Missing Required Label')).toBeFalsy();
|
|
231
|
-
});
|
|
232
|
-
});
|
|
233
|
-
|
|
234
|
-
describe('updates', () => {
|
|
235
|
-
it('updates when isLabelAvailable changes from false to true', () => {
|
|
236
|
-
const { queryByText, rerender } = render(<KeyLegend isLabelAvailable={false} />);
|
|
237
|
-
expect(queryByText('Missing Required Label')).toBeFalsy();
|
|
238
|
-
|
|
239
|
-
rerender(<KeyLegend isLabelAvailable={true} />);
|
|
240
|
-
expect(queryByText('Missing Required Label')).toBeTruthy();
|
|
241
|
-
});
|
|
242
|
-
|
|
243
|
-
it('updates when isLabelAvailable changes from true to false', () => {
|
|
244
|
-
const { queryByText, rerender } = render(<KeyLegend isLabelAvailable={true} />);
|
|
245
|
-
expect(queryByText('Missing Required Label')).toBeTruthy();
|
|
246
|
-
|
|
247
|
-
rerender(<KeyLegend isLabelAvailable={false} />);
|
|
248
|
-
expect(queryByText('Missing Required Label')).toBeFalsy();
|
|
249
|
-
});
|
|
250
|
-
|
|
251
|
-
it('updates className on rerender', () => {
|
|
252
|
-
const { container, rerender } = render(<KeyLegend className="class1" />);
|
|
253
|
-
expect(container.firstChild).toHaveClass('class1');
|
|
254
|
-
|
|
255
|
-
rerender(<KeyLegend className="class2" />);
|
|
256
|
-
expect(container.firstChild).toHaveClass('class2');
|
|
257
|
-
expect(container.firstChild).not.toHaveClass('class1');
|
|
258
|
-
});
|
|
259
|
-
});
|
|
260
|
-
});
|
|
@@ -1,278 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render } from '@pie-lib/test-utils';
|
|
3
|
-
|
|
4
|
-
import SvgIcon from '../label-svg-icon';
|
|
5
|
-
|
|
6
|
-
describe('SvgIcon', () => {
|
|
7
|
-
describe('rendering', () => {
|
|
8
|
-
it('renders without crashing with correct type', () => {
|
|
9
|
-
const { container } = render(<SvgIcon type="correct" />);
|
|
10
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it('renders correct icon type', () => {
|
|
14
|
-
const { container } = render(<SvgIcon type="correct" />);
|
|
15
|
-
const svg = container.querySelector('svg');
|
|
16
|
-
expect(svg).toBeInTheDocument();
|
|
17
|
-
expect(svg).toHaveAttribute('width', '8');
|
|
18
|
-
expect(svg).toHaveAttribute('height', '6');
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('renders incorrect icon type', () => {
|
|
22
|
-
const { container } = render(<SvgIcon type="incorrect" />);
|
|
23
|
-
const svg = container.querySelector('svg');
|
|
24
|
-
expect(svg).toBeInTheDocument();
|
|
25
|
-
expect(svg).toHaveAttribute('width', '7');
|
|
26
|
-
expect(svg).toHaveAttribute('height', '7');
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it('renders empty icon type', () => {
|
|
30
|
-
const { container } = render(<SvgIcon type="empty" />);
|
|
31
|
-
const svg = container.querySelector('svg');
|
|
32
|
-
expect(svg).toBeInTheDocument();
|
|
33
|
-
expect(svg).toHaveAttribute('width', '11');
|
|
34
|
-
expect(svg).toHaveAttribute('height', '12');
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it('renders null for unknown icon type', () => {
|
|
38
|
-
const { container } = render(<SvgIcon type="unknown" />);
|
|
39
|
-
expect(container.firstChild).toBeNull();
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it('renders null for invalid icon type', () => {
|
|
43
|
-
const { container } = render(<SvgIcon type="invalid" />);
|
|
44
|
-
expect(container.firstChild).toBeNull();
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
describe('correct icon', () => {
|
|
49
|
-
it('has correct viewBox attribute', () => {
|
|
50
|
-
const { container } = render(<SvgIcon type="correct" />);
|
|
51
|
-
const svg = container.querySelector('svg');
|
|
52
|
-
expect(svg).toHaveAttribute('viewBox', '0 0 8 6');
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it('has correct fill color for path', () => {
|
|
56
|
-
const { container } = render(<SvgIcon type="correct" />);
|
|
57
|
-
const path = container.querySelector('path');
|
|
58
|
-
expect(path).toHaveAttribute('fill', '#0B7D38');
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
it('has correct path d attribute for checkmark', () => {
|
|
62
|
-
const { container } = render(<SvgIcon type="correct" />);
|
|
63
|
-
const path = container.querySelector('path');
|
|
64
|
-
expect(path).toHaveAttribute('d');
|
|
65
|
-
const dAttribute = path.getAttribute('d');
|
|
66
|
-
expect(dAttribute).toContain('M6.79688');
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it('has xmlns attribute', () => {
|
|
70
|
-
const { container } = render(<SvgIcon type="correct" />);
|
|
71
|
-
const svg = container.querySelector('svg');
|
|
72
|
-
expect(svg).toHaveAttribute('xmlns', 'http://www.w3.org/2000/svg');
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
describe('incorrect icon', () => {
|
|
77
|
-
it('has correct viewBox attribute', () => {
|
|
78
|
-
const { container } = render(<SvgIcon type="incorrect" />);
|
|
79
|
-
const svg = container.querySelector('svg');
|
|
80
|
-
expect(svg).toHaveAttribute('viewBox', '0 0 7 7');
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
it('has correct fill color for path', () => {
|
|
84
|
-
const { container } = render(<SvgIcon type="incorrect" />);
|
|
85
|
-
const path = container.querySelector('path');
|
|
86
|
-
expect(path).toHaveAttribute('fill', '#BF0D00');
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
it('has correct path d attribute for X mark', () => {
|
|
90
|
-
const { container } = render(<SvgIcon type="incorrect" />);
|
|
91
|
-
const path = container.querySelector('path');
|
|
92
|
-
expect(path).toHaveAttribute('d');
|
|
93
|
-
const dAttribute = path.getAttribute('d');
|
|
94
|
-
expect(dAttribute).toContain('M4.23438');
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
it('has xmlns attribute', () => {
|
|
98
|
-
const { container } = render(<SvgIcon type="incorrect" />);
|
|
99
|
-
const svg = container.querySelector('svg');
|
|
100
|
-
expect(svg).toHaveAttribute('xmlns', 'http://www.w3.org/2000/svg');
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
describe('empty icon', () => {
|
|
105
|
-
it('has correct viewBox attribute', () => {
|
|
106
|
-
const { container } = render(<SvgIcon type="empty" />);
|
|
107
|
-
const svg = container.querySelector('svg');
|
|
108
|
-
expect(svg).toHaveAttribute('viewBox', '0 0 11 12');
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
it('has correct fill color for path', () => {
|
|
112
|
-
const { container } = render(<SvgIcon type="empty" />);
|
|
113
|
-
const path = container.querySelector('path');
|
|
114
|
-
expect(path).toHaveAttribute('fill', '#BF0D00');
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
it('has correct path d attribute for empty frame', () => {
|
|
118
|
-
const { container } = render(<SvgIcon type="empty" />);
|
|
119
|
-
const path = container.querySelector('path');
|
|
120
|
-
expect(path).toHaveAttribute('d');
|
|
121
|
-
const dAttribute = path.getAttribute('d');
|
|
122
|
-
expect(dAttribute).toContain('M0.25');
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
it('has xmlns attribute', () => {
|
|
126
|
-
const { container } = render(<SvgIcon type="empty" />);
|
|
127
|
-
const svg = container.querySelector('svg');
|
|
128
|
-
expect(svg).toHaveAttribute('xmlns', 'http://www.w3.org/2000/svg');
|
|
129
|
-
});
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
describe('icon structure', () => {
|
|
133
|
-
it('correct icon has one path element', () => {
|
|
134
|
-
const { container } = render(<SvgIcon type="correct" />);
|
|
135
|
-
const paths = container.querySelectorAll('path');
|
|
136
|
-
expect(paths.length).toBe(1);
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
it('incorrect icon has one path element', () => {
|
|
140
|
-
const { container } = render(<SvgIcon type="incorrect" />);
|
|
141
|
-
const paths = container.querySelectorAll('path');
|
|
142
|
-
expect(paths.length).toBe(1);
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
it('empty icon has one path element', () => {
|
|
146
|
-
const { container } = render(<SvgIcon type="empty" />);
|
|
147
|
-
const paths = container.querySelectorAll('path');
|
|
148
|
-
expect(paths.length).toBe(1);
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
it('each icon renders only one svg element', () => {
|
|
152
|
-
const { container: correctContainer } = render(<SvgIcon type="correct" />);
|
|
153
|
-
const { container: incorrectContainer } = render(<SvgIcon type="incorrect" />);
|
|
154
|
-
const { container: emptyContainer } = render(<SvgIcon type="empty" />);
|
|
155
|
-
|
|
156
|
-
expect(correctContainer.querySelectorAll('svg').length).toBe(1);
|
|
157
|
-
expect(incorrectContainer.querySelectorAll('svg').length).toBe(1);
|
|
158
|
-
expect(emptyContainer.querySelectorAll('svg').length).toBe(1);
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
describe('edge cases', () => {
|
|
163
|
-
it('handles empty string type gracefully', () => {
|
|
164
|
-
const { container } = render(<SvgIcon type="" />);
|
|
165
|
-
expect(container.firstChild).toBeNull();
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
it('handles null type gracefully', () => {
|
|
169
|
-
const { container } = render(<SvgIcon type={null} />);
|
|
170
|
-
expect(container.firstChild).toBeNull();
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
it('handles undefined type gracefully', () => {
|
|
174
|
-
const { container } = render(<SvgIcon type={undefined} />);
|
|
175
|
-
expect(container.firstChild).toBeNull();
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
it('handles numeric type gracefully', () => {
|
|
179
|
-
const { container } = render(<SvgIcon type={123} />);
|
|
180
|
-
expect(container.firstChild).toBeNull();
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
it('handles object type gracefully', () => {
|
|
184
|
-
const { container } = render(<SvgIcon type={{}} />);
|
|
185
|
-
expect(container.firstChild).toBeNull();
|
|
186
|
-
});
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
describe('icon differentiation', () => {
|
|
190
|
-
it('correct and incorrect icons have different dimensions', () => {
|
|
191
|
-
const { container: correctContainer } = render(<SvgIcon type="correct" />);
|
|
192
|
-
const { container: incorrectContainer } = render(<SvgIcon type="incorrect" />);
|
|
193
|
-
|
|
194
|
-
const correctSvg = correctContainer.querySelector('svg');
|
|
195
|
-
const incorrectSvg = incorrectContainer.querySelector('svg');
|
|
196
|
-
|
|
197
|
-
expect(correctSvg.getAttribute('width')).not.toBe(incorrectSvg.getAttribute('width'));
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
it('correct and empty icons have different fill colors', () => {
|
|
201
|
-
const { container: correctContainer } = render(<SvgIcon type="correct" />);
|
|
202
|
-
const { container: emptyContainer } = render(<SvgIcon type="empty" />);
|
|
203
|
-
|
|
204
|
-
const correctPath = correctContainer.querySelector('path');
|
|
205
|
-
const emptyPath = emptyContainer.querySelector('path');
|
|
206
|
-
|
|
207
|
-
expect(correctPath.getAttribute('fill')).not.toBe(emptyPath.getAttribute('fill'));
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
it('incorrect and empty icons have same fill color', () => {
|
|
211
|
-
const { container: incorrectContainer } = render(<SvgIcon type="incorrect" />);
|
|
212
|
-
const { container: emptyContainer } = render(<SvgIcon type="empty" />);
|
|
213
|
-
|
|
214
|
-
const incorrectPath = incorrectContainer.querySelector('path');
|
|
215
|
-
const emptyPath = emptyContainer.querySelector('path');
|
|
216
|
-
|
|
217
|
-
expect(incorrectPath.getAttribute('fill')).toBe(emptyPath.getAttribute('fill'));
|
|
218
|
-
});
|
|
219
|
-
|
|
220
|
-
it('each icon type has unique path data', () => {
|
|
221
|
-
const { container: correctContainer } = render(<SvgIcon type="correct" />);
|
|
222
|
-
const { container: incorrectContainer } = render(<SvgIcon type="incorrect" />);
|
|
223
|
-
const { container: emptyContainer } = render(<SvgIcon type="empty" />);
|
|
224
|
-
|
|
225
|
-
const correctPath = correctContainer.querySelector('path').getAttribute('d');
|
|
226
|
-
const incorrectPath = incorrectContainer.querySelector('path').getAttribute('d');
|
|
227
|
-
const emptyPath = emptyContainer.querySelector('path').getAttribute('d');
|
|
228
|
-
|
|
229
|
-
expect(correctPath).not.toBe(incorrectPath);
|
|
230
|
-
expect(correctPath).not.toBe(emptyPath);
|
|
231
|
-
expect(incorrectPath).not.toBe(emptyPath);
|
|
232
|
-
});
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
describe('SVG attributes', () => {
|
|
236
|
-
it('all icons have fill="none" on svg element', () => {
|
|
237
|
-
const { container: correctContainer } = render(<SvgIcon type="correct" />);
|
|
238
|
-
const { container: incorrectContainer } = render(<SvgIcon type="incorrect" />);
|
|
239
|
-
const { container: emptyContainer } = render(<SvgIcon type="empty" />);
|
|
240
|
-
|
|
241
|
-
expect(correctContainer.querySelector('svg')).toHaveAttribute('fill', 'none');
|
|
242
|
-
expect(incorrectContainer.querySelector('svg')).toHaveAttribute('fill', 'none');
|
|
243
|
-
expect(emptyContainer.querySelector('svg')).toHaveAttribute('fill', 'none');
|
|
244
|
-
});
|
|
245
|
-
|
|
246
|
-
it('all icons have proper xmlns namespace', () => {
|
|
247
|
-
const { container: correctContainer } = render(<SvgIcon type="correct" />);
|
|
248
|
-
const { container: incorrectContainer } = render(<SvgIcon type="incorrect" />);
|
|
249
|
-
const { container: emptyContainer } = render(<SvgIcon type="empty" />);
|
|
250
|
-
|
|
251
|
-
const xmlns = 'http://www.w3.org/2000/svg';
|
|
252
|
-
expect(correctContainer.querySelector('svg')).toHaveAttribute('xmlns', xmlns);
|
|
253
|
-
expect(incorrectContainer.querySelector('svg')).toHaveAttribute('xmlns', xmlns);
|
|
254
|
-
expect(emptyContainer.querySelector('svg')).toHaveAttribute('xmlns', xmlns);
|
|
255
|
-
});
|
|
256
|
-
});
|
|
257
|
-
|
|
258
|
-
describe('accessibility', () => {
|
|
259
|
-
it('svg elements are properly structured for screen readers', () => {
|
|
260
|
-
const { container } = render(<SvgIcon type="correct" />);
|
|
261
|
-
const svg = container.querySelector('svg');
|
|
262
|
-
|
|
263
|
-
// SVG should be in DOM
|
|
264
|
-
expect(svg).toBeInTheDocument();
|
|
265
|
-
|
|
266
|
-
// Should have valid viewBox for proper scaling
|
|
267
|
-
expect(svg.getAttribute('viewBox')).toBeTruthy();
|
|
268
|
-
});
|
|
269
|
-
|
|
270
|
-
it('icons render as inline elements', () => {
|
|
271
|
-
const { container } = render(<SvgIcon type="correct" />);
|
|
272
|
-
const svg = container.querySelector('svg');
|
|
273
|
-
|
|
274
|
-
// SVG should be direct child (inline)
|
|
275
|
-
expect(container.firstChild).toBe(svg);
|
|
276
|
-
});
|
|
277
|
-
});
|
|
278
|
-
});
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { render } from '@pie-lib/test-utils';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
|
|
4
|
-
import Labels, { getTransform } from '../labels';
|
|
5
|
-
|
|
6
|
-
describe('Labels', () => {
|
|
7
|
-
let onChange = jest.fn();
|
|
8
|
-
const renderComponent = (extras) => {
|
|
9
|
-
const defaults = {
|
|
10
|
-
classes: {},
|
|
11
|
-
className: 'className',
|
|
12
|
-
onChange,
|
|
13
|
-
graphProps: {
|
|
14
|
-
size: {
|
|
15
|
-
width: 400,
|
|
16
|
-
height: 400,
|
|
17
|
-
},
|
|
18
|
-
domain: {
|
|
19
|
-
min: 0,
|
|
20
|
-
max: 10,
|
|
21
|
-
step: 1,
|
|
22
|
-
padding: 0,
|
|
23
|
-
},
|
|
24
|
-
range: {
|
|
25
|
-
min: 0,
|
|
26
|
-
max: 10,
|
|
27
|
-
step: 1,
|
|
28
|
-
padding: 0,
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
const props = { ...defaults, ...extras };
|
|
33
|
-
return render(<Labels {...props} />);
|
|
34
|
-
};
|
|
35
|
-
describe('rendering', () => {
|
|
36
|
-
it('renders without crashing', () => {
|
|
37
|
-
const { container } = renderComponent();
|
|
38
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
describe('getTransform', () => {
|
|
44
|
-
const assertTransform = (side, expected) => {
|
|
45
|
-
it(`returns ${expected} for ${side}`, () => {
|
|
46
|
-
const r = getTransform('left', 100, 100);
|
|
47
|
-
expect(r).toEqual('translate(-20, 50), rotate(-90)');
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
assertTransform('left', 'translate(-20, 50), rotate(-90)');
|
|
52
|
-
assertTransform('right', 'translate(130, 50), rotate(90)');
|
|
53
|
-
assertTransform('top', 'translate(50, -20), rotate(0)');
|
|
54
|
-
assertTransform('bottom', 'translate(50, 130), rotate(0)');
|
|
55
|
-
});
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { render } from '@pie-lib/test-utils';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { coordinates, MarkLabel, position } from '../mark-label';
|
|
4
|
-
import { graphProps as getGraphProps } from './utils';
|
|
5
|
-
|
|
6
|
-
describe('MarkLabel', () => {
|
|
7
|
-
let onChange = jest.fn();
|
|
8
|
-
let inputRef = jest.fn();
|
|
9
|
-
const renderComponent = (extras) => {
|
|
10
|
-
const defaults = {
|
|
11
|
-
classes: {},
|
|
12
|
-
className: 'className',
|
|
13
|
-
onChange,
|
|
14
|
-
inputRef,
|
|
15
|
-
mark: { x: 1, y: 1 },
|
|
16
|
-
graphProps: getGraphProps(0, 10, 0, 10),
|
|
17
|
-
};
|
|
18
|
-
const props = { ...defaults, ...extras };
|
|
19
|
-
return render(<MarkLabel {...props} />);
|
|
20
|
-
};
|
|
21
|
-
describe('rendering', () => {
|
|
22
|
-
it('renders without crashing', () => {
|
|
23
|
-
const { container } = renderComponent();
|
|
24
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
25
|
-
});
|
|
26
|
-
it('renders with different mark position', () => {
|
|
27
|
-
const { container } = renderComponent({ mark: { x: 10, y: 10 } });
|
|
28
|
-
expect(container.firstChild).toBeInTheDocument();
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
describe('position', () => {
|
|
34
|
-
const assertPosition = (mark, rect, expected) => {
|
|
35
|
-
it(`${mark.x},${mark.y} + ${rect.width},${rect.height} => ${expected}`, () => {
|
|
36
|
-
// we set range.min to a value because in pixels - the greater the Y the lower down on the screen.
|
|
37
|
-
const graphProps = getGraphProps(0, 12, 12, 0);
|
|
38
|
-
const result = position(graphProps, mark, rect);
|
|
39
|
-
expect(result).toEqual(expected);
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
assertPosition({ x: 0, y: 0 }, { width: 10, height: 10 }, 'top-left');
|
|
44
|
-
assertPosition({ x: 0, y: 0 }, { width: 1, height: 1 }, 'bottom-right');
|
|
45
|
-
assertPosition({ x: 0, y: 0 }, { width: 10, height: 0 }, 'bottom-left');
|
|
46
|
-
assertPosition({ x: 0, y: 0 }, { width: 0, height: 10 }, 'top-right');
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
describe('coordinates', () => {
|
|
50
|
-
const assertCoordinates = (mark, rect, pos, expected) => {
|
|
51
|
-
it(`${mark.x}, ${mark.y} -> ${pos} = ${expected.left}, ${expected.top}`, () => {
|
|
52
|
-
const result = coordinates(getGraphProps(), mark, rect, pos);
|
|
53
|
-
expect(result).toEqual(expected);
|
|
54
|
-
});
|
|
55
|
-
};
|
|
56
|
-
assertCoordinates({ x: 0, y: 0 }, { width: 0, height: 0 }, 'top-left', { left: -5, top: -5 });
|
|
57
|
-
assertCoordinates({ x: 0, y: 0 }, { width: 0, height: 0 }, 'bottom-left', { left: -5, top: 5 });
|
|
58
|
-
assertCoordinates({ x: 0, y: 0 }, { width: 0, height: 0 }, 'top-right', { left: 5, top: -5 });
|
|
59
|
-
assertCoordinates({ x: 0, y: 0 }, { width: 0, height: 0 }, 'bottom-right', {
|
|
60
|
-
left: 5,
|
|
61
|
-
top: 5,
|
|
62
|
-
});
|
|
63
|
-
});
|