@mathstack/viz 2.1.0 → 2.2.1
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/LICENSE +21 -21
- package/README.md +11 -11
- package/fesm2022/mathstack-viz.mjs +11024 -0
- package/fesm2022/mathstack-viz.mjs.map +1 -0
- package/package.json +18 -6
- package/types/mathstack-viz.d.ts +5830 -0
- package/CHANGELOG.md +0 -0
- package/cypress/fixtures/example.json +0 -5
- package/cypress/fixtures/usMap.json +0 -13511
- package/cypress/support/commands.ts +0 -104
- package/cypress/support/component-index.html +0 -12
- package/cypress/support/component.ts +0 -33
- package/cypress.config.ts +0 -9
- package/karma.conf.js +0 -62
- package/ng-package.json +0 -8
- package/project.json +0 -97
- package/src/.eslintrc.json +0 -35
- package/src/.prettierrc +0 -31
- package/src/lib/axes/base/config/xy-axis-builder.ts +0 -68
- package/src/lib/axes/base/config/xy-axis-config.ts +0 -35
- package/src/lib/axes/base/config/xy-axis-options.ts +0 -11
- package/src/lib/axes/base/xy-axis-base.spec.ts +0 -114
- package/src/lib/axes/base/xy-axis-base.ts +0 -305
- package/src/lib/axes/base/xy-axis-domain-lines.cy.ts +0 -511
- package/src/lib/axes/baseline/axis-baseline-builder.ts +0 -77
- package/src/lib/axes/baseline/axis-baseline-options.ts +0 -4
- package/src/lib/axes/baseline/axis-baseline.ts +0 -11
- package/src/lib/axes/grid/grid-builder.ts +0 -74
- package/src/lib/axes/grid/grid-config.ts +0 -13
- package/src/lib/axes/grid/grid-options.ts +0 -7
- package/src/lib/axes/index.ts +0 -40
- package/src/lib/axes/label/axis-label-builder.ts +0 -140
- package/src/lib/axes/label/axis-label-options.ts +0 -12
- package/src/lib/axes/label/axis-label.ts +0 -18
- package/src/lib/axes/label/axis-labels.cy.ts +0 -303
- package/src/lib/axes/ordinal/ordinal-axis-config.ts +0 -31
- package/src/lib/axes/ordinal/ordinal-axis.spec.ts +0 -30
- package/src/lib/axes/ordinal/ordinal-axis.ts +0 -26
- package/src/lib/axes/quantitative/quantitative-axis-config.ts +0 -39
- package/src/lib/axes/quantitative/quantitative-axis-ticks.cy.ts +0 -748
- package/src/lib/axes/quantitative/quantitative-axis.spec.ts +0 -537
- package/src/lib/axes/quantitative/quantitative-axis.ts +0 -191
- package/src/lib/axes/ticks/tick-wrap/tick-wrap-builder.ts +0 -141
- package/src/lib/axes/ticks/tick-wrap/tick-wrap-options.ts +0 -11
- package/src/lib/axes/ticks/tick-wrap/tick-wrap.cy.ts +0 -360
- package/src/lib/axes/ticks/tick-wrap/tick-wrap.ts +0 -21
- package/src/lib/axes/ticks/ticks-builder.ts +0 -370
- package/src/lib/axes/ticks/ticks-options.ts +0 -24
- package/src/lib/axes/ticks/ticks.ts +0 -33
- package/src/lib/axes/x/x-axis-config.ts +0 -48
- package/src/lib/axes/x/x-axis.spec.ts +0 -90
- package/src/lib/axes/x/x-axis.ts +0 -109
- package/src/lib/axes/x-ordinal/x-ordinal-axis-builder.ts +0 -75
- package/src/lib/axes/x-ordinal/x-ordinal-axis-config.ts +0 -27
- package/src/lib/axes/x-ordinal/x-ordinal-axis.component.ts +0 -33
- package/src/lib/axes/x-quantitative/x-quantitative-axis-builder.ts +0 -74
- package/src/lib/axes/x-quantitative/x-quantitative-axis-config.ts +0 -32
- package/src/lib/axes/x-quantitative/x-quantitative-axis.component.ts +0 -40
- package/src/lib/axes/xy-axis.module.ts +0 -20
- package/src/lib/axes/y/y-axis-config.ts +0 -47
- package/src/lib/axes/y/y-axis.spec.ts +0 -92
- package/src/lib/axes/y/y-axis.ts +0 -161
- package/src/lib/axes/y-ordinal/y-ordinal-axis-builder.ts +0 -76
- package/src/lib/axes/y-ordinal/y-ordinal-axis-config.ts +0 -29
- package/src/lib/axes/y-ordinal/y-ordinal-axis.component.ts +0 -33
- package/src/lib/axes/y-quantitative-axis/y-quantitative-axis-builder.ts +0 -74
- package/src/lib/axes/y-quantitative-axis/y-quantitative-axis-config.ts +0 -34
- package/src/lib/axes/y-quantitative-axis/y-quantitative-axis.component.ts +0 -40
- package/src/lib/bars/bars.component.scss +0 -0
- package/src/lib/bars/bars.component.spec.ts +0 -1470
- package/src/lib/bars/bars.component.ts +0 -717
- package/src/lib/bars/bars.cy.ts +0 -829
- package/src/lib/bars/bars.module.ts +0 -9
- package/src/lib/bars/config/backgrounds/bars-backgrounds-builder.ts +0 -51
- package/src/lib/bars/config/backgrounds/bars-backgrounds-options.ts +0 -4
- package/src/lib/bars/config/backgrounds/bars-backgrounds.ts +0 -11
- package/src/lib/bars/config/bars-builder.ts +0 -340
- package/src/lib/bars/config/bars-config.spec.ts +0 -132
- package/src/lib/bars/config/bars-config.ts +0 -70
- package/src/lib/bars/config/bars-dimensions.ts +0 -29
- package/src/lib/bars/config/bars-options.ts +0 -20
- package/src/lib/bars/config/labels/bars-labels-builder.ts +0 -89
- package/src/lib/bars/config/labels/bars-labels-options.ts +0 -6
- package/src/lib/bars/config/labels/bars-labels.cy.ts +0 -781
- package/src/lib/bars/config/labels/bars-labels.ts +0 -13
- package/src/lib/bars/events/actions/bars-click-actions.ts +0 -23
- package/src/lib/bars/events/actions/bars-hover-actions.ts +0 -43
- package/src/lib/bars/events/actions/bars-hover-move-actions.ts +0 -21
- package/src/lib/bars/events/bars-events.directive.spec.ts +0 -186
- package/src/lib/bars/events/bars-events.directive.ts +0 -235
- package/src/lib/bars/events/bars-interaction-output.ts +0 -17
- package/src/lib/bars/events/bars-tooltip-positioner.ts +0 -24
- package/src/lib/bars/index.ts +0 -18
- package/src/lib/charts/chart/chart-scaling.cy.ts +0 -323
- package/src/lib/charts/chart/chart.component.html +0 -45
- package/src/lib/charts/chart/chart.component.scss +0 -37
- package/src/lib/charts/chart/chart.component.ts +0 -243
- package/src/lib/charts/chart/chart.token.ts +0 -4
- package/src/lib/charts/chart/chart.ts +0 -5
- package/src/lib/charts/chart/config/chart-builder.ts +0 -194
- package/src/lib/charts/chart/config/chart-config.ts +0 -21
- package/src/lib/charts/chart/config/chart-options.ts +0 -11
- package/src/lib/charts/chart.module.ts +0 -10
- package/src/lib/charts/index.ts +0 -9
- package/src/lib/charts/map-chart/map-chart.component.scss +0 -0
- package/src/lib/charts/map-chart/map-chart.component.spec.ts +0 -35
- package/src/lib/charts/map-chart/map-chart.component.ts +0 -61
- package/src/lib/charts/xy-chart/xy-chart.component.spec.ts +0 -34
- package/src/lib/charts/xy-chart/xy-chart.component.ts +0 -65
- package/src/lib/core/common-behaviors/constructor.ts +0 -7
- package/src/lib/core/index.ts +0 -11
- package/src/lib/core/pipes/resize-chart-height.pipe.spec.ts +0 -23
- package/src/lib/core/pipes/resize-chart-height.pipe.ts +0 -20
- package/src/lib/core/styles/_spacing.scss +0 -4
- package/src/lib/core/types/layout.ts +0 -28
- package/src/lib/core/types/scale.ts +0 -6
- package/src/lib/core/types/utility.ts +0 -11
- package/src/lib/core/types/values.ts +0 -10
- package/src/lib/core/utilities/colors.spec.ts +0 -57
- package/src/lib/core/utilities/colors.ts +0 -42
- package/src/lib/core/utilities/fill-utilities.spec.ts +0 -25
- package/src/lib/core/utilities/fill-utilities.ts +0 -21
- package/src/lib/core/utilities/type-guards.spec.ts +0 -55
- package/src/lib/core/utilities/type-guards.ts +0 -33
- package/src/lib/core/utilities/value-format.ts +0 -21
- package/src/lib/core/utilities/values.spec.ts +0 -954
- package/src/lib/core/utilities/values.ts +0 -189
- package/src/lib/data-dimensions/continuous-quantitative/date-chart-position/date-chart-position-builder.ts +0 -105
- package/src/lib/data-dimensions/continuous-quantitative/date-chart-position/date-chart-position-options.ts +0 -24
- package/src/lib/data-dimensions/continuous-quantitative/date-chart-position/date-chart-position.spec.ts +0 -66
- package/src/lib/data-dimensions/continuous-quantitative/date-chart-position/date-chart-position.ts +0 -72
- package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/domain-padding/concrete-domain-padding.ts +0 -10
- package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/domain-padding/domain-padding.ts +0 -76
- package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/domain-padding/domain-test-utility.ts +0 -130
- package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/domain-padding/percent-over/percent-over-options.ts +0 -3
- package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/domain-padding/percent-over/percent-over.ts +0 -37
- package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/domain-padding/pixel/pixel-options.ts +0 -3
- package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/domain-padding/pixel/pixel.ts +0 -73
- package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/domain-padding/quantitative-domain-padding.cy.ts +0 -978
- package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/domain-padding/round-to-interval/round-to-interval-options.ts +0 -3
- package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/domain-padding/round-to-interval/round-to-interval.ts +0 -27
- package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/domain-padding/round-to-sig-fig/round-to-sig-fig-options.ts +0 -3
- package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/domain-padding/round-to-sig-fig/round-to-sig-fig.ts +0 -30
- package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/number-chart-position-builder.ts +0 -183
- package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/number-chart-position-options.ts +0 -8
- package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/number-chart-position.spec.ts +0 -28
- package/src/lib/data-dimensions/continuous-quantitative/number-chart-position/number-chart-position.ts +0 -62
- package/src/lib/data-dimensions/continuous-quantitative/number-dimension/number-dimension-options.ts +0 -15
- package/src/lib/data-dimensions/continuous-quantitative/number-dimension/number-dimension.spec.ts +0 -155
- package/src/lib/data-dimensions/continuous-quantitative/number-dimension/number-dimension.ts +0 -57
- package/src/lib/data-dimensions/continuous-quantitative/number-visual-value/number-visual-value-builder.ts +0 -166
- package/src/lib/data-dimensions/continuous-quantitative/number-visual-value/number-visual-value-options.ts +0 -10
- package/src/lib/data-dimensions/continuous-quantitative/number-visual-value/number-visual-value.spec.ts +0 -34
- package/src/lib/data-dimensions/continuous-quantitative/number-visual-value/number-visual-value.ts +0 -57
- package/src/lib/data-dimensions/dimension-builder.ts +0 -45
- package/src/lib/data-dimensions/dimension-options.ts +0 -12
- package/src/lib/data-dimensions/dimension.ts +0 -30
- package/src/lib/data-dimensions/index.ts +0 -31
- package/src/lib/data-dimensions/ordinal/ordinal-chart-position/ordinal-chart-position-builder.ts +0 -122
- package/src/lib/data-dimensions/ordinal/ordinal-chart-position/ordinal-chart-position-options.ts +0 -12
- package/src/lib/data-dimensions/ordinal/ordinal-chart-position/ordinal-chart-position.spec.ts +0 -83
- package/src/lib/data-dimensions/ordinal/ordinal-chart-position/ordinal-chart-position.ts +0 -101
- package/src/lib/data-dimensions/ordinal/ordinal-visual-value/ordinal-visual-value-builder.ts +0 -108
- package/src/lib/data-dimensions/ordinal/ordinal-visual-value/ordinal-visual-value-options.ts +0 -12
- package/src/lib/data-dimensions/ordinal/ordinal-visual-value/ordinal-visual-value.cy.ts +0 -384
- package/src/lib/data-dimensions/ordinal/ordinal-visual-value/ordinal-visual-value.spec.ts +0 -63
- package/src/lib/data-dimensions/ordinal/ordinal-visual-value/ordinal-visual-value.ts +0 -79
- package/src/lib/data-export/data-export-config.ts +0 -98
- package/src/lib/data-export/data-export.spec.ts +0 -33
- package/src/lib/data-export/data-export.ts +0 -87
- package/src/lib/data-export/index.ts +0 -2
- package/src/lib/dots/config/dots-builder.ts +0 -442
- package/src/lib/dots/config/dots-config.spec.ts +0 -123
- package/src/lib/dots/config/dots-config.ts +0 -81
- package/src/lib/dots/config/dots-options.ts +0 -32
- package/src/lib/dots/dots.component.scss +0 -0
- package/src/lib/dots/dots.component.spec.ts +0 -143
- package/src/lib/dots/dots.component.ts +0 -291
- package/src/lib/dots/dots.cy.ts +0 -594
- package/src/lib/dots/dots.module.ts +0 -9
- package/src/lib/dots/events/actions/dots-hover-actions.ts +0 -19
- package/src/lib/dots/events/actions/dots-hover-move-actions.ts +0 -38
- package/src/lib/dots/events/dots-events.directive.ts +0 -214
- package/src/lib/dots/events/dots-interaction-output.ts +0 -15
- package/src/lib/dots/events/dots-tooltip-positioner.ts +0 -24
- package/src/lib/dots/index.ts +0 -10
- package/src/lib/events/events.directive.ts +0 -184
- package/src/lib/events/events.types.ts +0 -57
- package/src/lib/events/index.ts +0 -4
- package/src/lib/events/interaction-output.ts +0 -34
- package/src/lib/events/tooltip-positioner.ts +0 -15
- package/src/lib/fill-definitions/fill-definitions.ts +0 -4
- package/src/lib/fill-definitions/index.ts +0 -1
- package/src/lib/geographies/config/geographies-builder.ts +0 -224
- package/src/lib/geographies/config/geographies-config.spec.ts +0 -100
- package/src/lib/geographies/config/geographies-config.ts +0 -81
- package/src/lib/geographies/config/geographies-options.ts +0 -37
- package/src/lib/geographies/config/layers/attribute-data-layer/attribute-data-layer-builder.ts +0 -212
- package/src/lib/geographies/config/layers/attribute-data-layer/attribute-data-layer-options.ts +0 -26
- package/src/lib/geographies/config/layers/attribute-data-layer/attribute-data-layer.spec.ts +0 -119
- package/src/lib/geographies/config/layers/attribute-data-layer/attribute-data-layer.ts +0 -148
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/attribute-data/attribute-data-dimension-builder.ts +0 -65
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/attribute-data/attribute-data-dimension-options.ts +0 -15
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/attribute-data/attribute-data-dimension.ts +0 -32
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/attribute-data-bin-enums.ts +0 -10
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/attribute-data-bin-types.ts +0 -15
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/calculated-bins/calculated-bins-builder.ts +0 -18
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/calculated-bins/calculated-bins-options.ts +0 -8
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/calculated-bins/calculated-bins.spec.ts +0 -60
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/calculated-bins/calculated-bins.ts +0 -34
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/categorical-bins/categorical-bins-builder.ts +0 -46
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/categorical-bins/categorical-bins-options.ts +0 -8
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/categorical-bins/categorical-bins.cy.ts +0 -437
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/categorical-bins/categorical-bins.spec.ts +0 -105
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/categorical-bins/categorical-bins.ts +0 -54
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/custom-breaks/custom-breaks-bins-builder.ts +0 -65
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/custom-breaks/custom-breaks-bins-options.ts +0 -9
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/custom-breaks/custom-breaks-bins.spec.ts +0 -82
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/custom-breaks/custom-breaks-bins.ts +0 -81
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/custom-breaks/custom-breaks.cy.ts +0 -378
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/equal-frequencies-bins/equal-frequencies-bins-builder.ts +0 -50
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/equal-frequencies-bins/equal-frequencies-bins-options.ts +0 -8
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/equal-frequencies-bins/equal-frequencies-bins.cy.ts +0 -362
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/equal-frequencies-bins/equal-frequencies-bins.spec.ts +0 -72
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/equal-frequencies-bins/equal-frequencies-bins.ts +0 -56
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/equal-value-ranges-bins/equal-value-ranges-bins-builder.ts +0 -60
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/equal-value-ranges-bins/equal-value-ranges-bins-options.ts +0 -9
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/equal-value-ranges-bins/equal-value-ranges-bins.cy.ts +0 -307
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/equal-value-ranges-bins/equal-value-ranges-bins.spec.ts +0 -104
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/equal-value-ranges-bins/equal-value-ranges-bins.ts +0 -89
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/no-bins/no-bins-builder.ts +0 -62
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/no-bins/no-bins-options.ts +0 -8
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/no-bins/no-bins.cy.ts +0 -265
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/no-bins/no-bins.spec.ts +0 -42
- package/src/lib/geographies/config/layers/attribute-data-layer/dimensions/no-bins/no-bins.ts +0 -42
- package/src/lib/geographies/config/layers/geographies-layer/geographies-layer-builder.ts +0 -116
- package/src/lib/geographies/config/layers/geographies-layer/geographies-layer-options.ts +0 -20
- package/src/lib/geographies/config/layers/geographies-layer/geographies-layer.ts +0 -104
- package/src/lib/geographies/config/layers/geojson-properties-layer/geojson-properties-layer-builder.ts +0 -111
- package/src/lib/geographies/config/layers/geojson-properties-layer/geojson-properties-layer-options.ts +0 -19
- package/src/lib/geographies/config/layers/geojson-properties-layer/geojson-properties-layer.spec.ts +0 -41
- package/src/lib/geographies/config/layers/geojson-properties-layer/geojson-properties-layer.ts +0 -67
- package/src/lib/geographies/config/layers/labels/geographies-labels-builder.ts +0 -269
- package/src/lib/geographies/config/layers/labels/geographies-labels-options.ts +0 -45
- package/src/lib/geographies/config/layers/labels/geographies-labels.ts +0 -38
- package/src/lib/geographies/events/actions/geographies-click-actions.ts +0 -21
- package/src/lib/geographies/events/actions/geographies-hover-actions.ts +0 -17
- package/src/lib/geographies/events/actions/geographies-hover-move-actions.ts +0 -19
- package/src/lib/geographies/events/geographies-events.directive.spec.ts +0 -225
- package/src/lib/geographies/events/geographies-events.directive.ts +0 -235
- package/src/lib/geographies/events/geographies-interaction-output.ts +0 -17
- package/src/lib/geographies/events/geographies-tooltip-positioner.ts +0 -23
- package/src/lib/geographies/geographies-feature.ts +0 -16
- package/src/lib/geographies/geographies.component.html +0 -1
- package/src/lib/geographies/geographies.component.scss +0 -0
- package/src/lib/geographies/geographies.component.spec.ts +0 -148
- package/src/lib/geographies/geographies.component.ts +0 -318
- package/src/lib/geographies/geographies.cy.ts +0 -640
- package/src/lib/geographies/geographies.module.ts +0 -9
- package/src/lib/geographies/index.ts +0 -32
- package/src/lib/grouped-bars/config/grouped-bars-builder.ts +0 -66
- package/src/lib/grouped-bars/config/grouped-bars-config.ts +0 -41
- package/src/lib/grouped-bars/config/grouped-bars-options.ts +0 -9
- package/src/lib/grouped-bars/events/grouped-bars-events.directive.ts +0 -221
- package/src/lib/grouped-bars/grouped-bars.component.scss +0 -0
- package/src/lib/grouped-bars/grouped-bars.component.spec.ts +0 -25
- package/src/lib/grouped-bars/grouped-bars.component.ts +0 -94
- package/src/lib/grouped-bars/grouped-bars.module.ts +0 -9
- package/src/lib/grouped-bars/index.ts +0 -10
- package/src/lib/image-download/image-download-config.ts +0 -57
- package/src/lib/image-download/image-download-enums.ts +0 -7
- package/src/lib/image-download/image-download-options.ts +0 -14
- package/src/lib/image-download/image-download.service.ts +0 -70
- package/src/lib/image-download/index.ts +0 -4
- package/src/lib/lines/config/area-fills/area-fills-builder.ts +0 -87
- package/src/lib/lines/config/area-fills/area-fills-options.ts +0 -8
- package/src/lib/lines/config/area-fills/area-fills.ts +0 -14
- package/src/lib/lines/config/lines-builder.ts +0 -242
- package/src/lib/lines/config/lines-config.spec.ts +0 -52
- package/src/lib/lines/config/lines-config.ts +0 -96
- package/src/lib/lines/config/lines-options.ts +0 -19
- package/src/lib/lines/config/stroke/lines-stroke-builder.ts +0 -135
- package/src/lib/lines/config/stroke/lines-stroke-options.ts +0 -6
- package/src/lib/lines/config/stroke/lines-stroke.ts +0 -15
- package/src/lib/lines/events/actions/lines-click-actions.ts +0 -17
- package/src/lib/lines/events/actions/lines-hover-move-actions.ts +0 -113
- package/src/lib/lines/events/actions/lines-marker-click-actions.ts +0 -29
- package/src/lib/lines/events/lines-events.directive.spec.ts +0 -152
- package/src/lib/lines/events/lines-events.directive.ts +0 -310
- package/src/lib/lines/events/lines-interaction-output.ts +0 -17
- package/src/lib/lines/events/lines-tooltip-positioner.ts +0 -24
- package/src/lib/lines/index.ts +0 -17
- package/src/lib/lines/lines.component.scss +0 -0
- package/src/lib/lines/lines.component.spec.ts +0 -95
- package/src/lib/lines/lines.component.ts +0 -425
- package/src/lib/lines/lines.cy.ts +0 -738
- package/src/lib/lines/lines.module.ts +0 -9
- package/src/lib/map-legend/continuous-legend/continuous-legend.component.html +0 -28
- package/src/lib/map-legend/continuous-legend/continuous-legend.component.scss +0 -76
- package/src/lib/map-legend/continuous-legend/continuous-legend.component.spec.ts +0 -61
- package/src/lib/map-legend/continuous-legend/continuous-legend.component.ts +0 -82
- package/src/lib/map-legend/discontinuous-legend/discontinuous-legend.component.html +0 -40
- package/src/lib/map-legend/discontinuous-legend/discontinuous-legend.component.scss +0 -141
- package/src/lib/map-legend/discontinuous-legend/discontinuous-legend.component.spec.ts +0 -75
- package/src/lib/map-legend/discontinuous-legend/discontinuous-legend.component.ts +0 -57
- package/src/lib/map-legend/index.ts +0 -2
- package/src/lib/map-legend/map-legend-base.spec.ts +0 -190
- package/src/lib/map-legend/map-legend-base.ts +0 -99
- package/src/lib/map-legend/map-legend.component.html +0 -24
- package/src/lib/map-legend/map-legend.component.scss +0 -0
- package/src/lib/map-legend/map-legend.component.spec.ts +0 -125
- package/src/lib/map-legend/map-legend.component.ts +0 -80
- package/src/lib/map-legend/map-legend.module.ts +0 -8
- package/src/lib/marks/aux-marks/aux-marks.ts +0 -18
- package/src/lib/marks/aux-marks/config/aux-marks-builder.ts +0 -25
- package/src/lib/marks/aux-marks/config/aux-marks-config.ts +0 -6
- package/src/lib/marks/config/marks-config.ts +0 -14
- package/src/lib/marks/config/marks-options.ts +0 -9
- package/src/lib/marks/index.ts +0 -15
- package/src/lib/marks/map-marks/map-aux-marks/map-aux-marks.spec.ts +0 -74
- package/src/lib/marks/map-marks/map-aux-marks/map-aux-marks.ts +0 -40
- package/src/lib/marks/map-marks/map-primary-marks/map-primary-marks.spec.ts +0 -79
- package/src/lib/marks/map-marks/map-primary-marks/map-primary-marks.ts +0 -63
- package/src/lib/marks/marks.ts +0 -39
- package/src/lib/marks/primary-marks/config/primary-marks-builder.ts +0 -75
- package/src/lib/marks/primary-marks/config/primary-marks-config.ts +0 -9
- package/src/lib/marks/primary-marks/primary-marks-base.spec.ts +0 -58
- package/src/lib/marks/primary-marks/primary-marks.ts +0 -43
- package/src/lib/marks/xy-marks/xy-aux-marks/xy-aux-marks.ts +0 -40
- package/src/lib/marks/xy-marks/xy-marks-config.ts +0 -5
- package/src/lib/marks/xy-marks/xy-marks.ts +0 -10
- package/src/lib/marks/xy-marks/xy-primary-marks/xy-primary-marks-config.ts +0 -7
- package/src/lib/marks/xy-marks/xy-primary-marks/xy-primary-marks.spec.ts +0 -186
- package/src/lib/marks/xy-marks/xy-primary-marks/xy-primary-marks.ts +0 -72
- package/src/lib/point-markers/index.ts +0 -3
- package/src/lib/point-markers/point-markers-builder.ts +0 -93
- package/src/lib/point-markers/point-markers-options.ts +0 -6
- package/src/lib/point-markers/point-markers.ts +0 -13
- package/src/lib/quantitative-rules/config/labels/quantitative-rules-labels-builder.ts +0 -162
- package/src/lib/quantitative-rules/config/labels/quantitative-rules-labels-options.ts +0 -17
- package/src/lib/quantitative-rules/config/labels/quantitative-rules-labels.ts +0 -26
- package/src/lib/quantitative-rules/config/quantitative-rules-builder.ts +0 -134
- package/src/lib/quantitative-rules/config/quantitative-rules-config.ts +0 -21
- package/src/lib/quantitative-rules/config/quantitative-rules-dimensions.ts +0 -20
- package/src/lib/quantitative-rules/config/quantitative-rules-options.ts +0 -13
- package/src/lib/quantitative-rules/index.ts +0 -6
- package/src/lib/quantitative-rules/quantitative-rules.component.scss +0 -3
- package/src/lib/quantitative-rules/quantitative-rules.component.spec.ts +0 -50
- package/src/lib/quantitative-rules/quantitative-rules.component.ts +0 -224
- package/src/lib/quantitative-rules/quantitative-rules.cy.ts +0 -549
- package/src/lib/quantitative-rules/quantitative-rules.module.ts +0 -8
- package/src/lib/stacked-area/config/stacked-area-builder.ts +0 -264
- package/src/lib/stacked-area/config/stacked-area-config.spec.ts +0 -107
- package/src/lib/stacked-area/config/stacked-area-config.ts +0 -109
- package/src/lib/stacked-area/config/stacked-area-options.ts +0 -28
- package/src/lib/stacked-area/events/actions/stacked-area-hover-move-actions.ts +0 -17
- package/src/lib/stacked-area/events/stacked-area-events.directive.spec.ts +0 -168
- package/src/lib/stacked-area/events/stacked-area-events.directive.ts +0 -272
- package/src/lib/stacked-area/events/stacked-area-interaction-output.ts +0 -33
- package/src/lib/stacked-area/events/stacked-area-tooltip-positioner.ts +0 -37
- package/src/lib/stacked-area/index.ts +0 -7
- package/src/lib/stacked-area/stacked-area.component.scss +0 -0
- package/src/lib/stacked-area/stacked-area.component.spec.ts +0 -41
- package/src/lib/stacked-area/stacked-area.component.ts +0 -241
- package/src/lib/stacked-area/stacked-area.module.ts +0 -9
- package/src/lib/stacked-bars/config/stacked-bars-builder.ts +0 -109
- package/src/lib/stacked-bars/config/stacked-bars-config.spec.ts +0 -122
- package/src/lib/stacked-bars/config/stacked-bars-config.ts +0 -79
- package/src/lib/stacked-bars/config/stacked-bars-options.ts +0 -16
- package/src/lib/stacked-bars/events/actions/stacked-bars-click-actions.ts +0 -23
- package/src/lib/stacked-bars/events/actions/stacked-bars-hover-actions.ts +0 -22
- package/src/lib/stacked-bars/events/actions/stacked-bars-hover-move-actions.ts +0 -21
- package/src/lib/stacked-bars/events/stacked-bars-events.directive.spec.ts +0 -266
- package/src/lib/stacked-bars/events/stacked-bars-events.directive.ts +0 -240
- package/src/lib/stacked-bars/index.ts +0 -10
- package/src/lib/stacked-bars/stacked-bars.component.scss +0 -0
- package/src/lib/stacked-bars/stacked-bars.component.spec.ts +0 -25
- package/src/lib/stacked-bars/stacked-bars.component.ts +0 -158
- package/src/lib/stacked-bars/stacked-bars.module.ts +0 -9
- package/src/lib/stroke/base/stroke-base-options.ts +0 -7
- package/src/lib/stroke/base/stroke-base.ts +0 -9
- package/src/lib/stroke/index.ts +0 -5
- package/src/lib/stroke/stroke-builder.ts +0 -103
- package/src/lib/stroke/stroke-options.ts +0 -5
- package/src/lib/stroke/stroke.ts +0 -12
- package/src/lib/svg-text-wrap/index.ts +0 -3
- package/src/lib/svg-text-wrap/svg-text-wrap-builder.ts +0 -105
- package/src/lib/svg-text-wrap/svg-text-wrap-options.ts +0 -8
- package/src/lib/svg-text-wrap/svg-text-wrap.ts +0 -137
- package/src/lib/testing/data/continent-population-year-data.ts +0 -126
- package/src/lib/testing/data/country-area-continent.ts +0 -59
- package/src/lib/testing/data/state-population-income-year-data.ts +0 -123
- package/src/lib/testing/stubs/bars.component.stub.ts +0 -12
- package/src/lib/testing/stubs/chart.component.stub.ts +0 -6
- package/src/lib/testing/stubs/click.directive.stub.ts +0 -15
- package/src/lib/testing/stubs/core/destroy-ref.stub.ts +0 -9
- package/src/lib/testing/stubs/core/overlay-ref.stub.ts +0 -13
- package/src/lib/testing/stubs/core/overlay.stub.ts +0 -8
- package/src/lib/testing/stubs/event.directive.stub.ts +0 -10
- package/src/lib/testing/stubs/hover-move.directive.stub.ts +0 -17
- package/src/lib/testing/stubs/hover.directive.stub.ts +0 -14
- package/src/lib/testing/stubs/input-event.directive.stub.ts +0 -9
- package/src/lib/testing/stubs/lines.component.stub.ts +0 -13
- package/src/lib/testing/stubs/map-aux-marks.stub.ts +0 -10
- package/src/lib/testing/stubs/map-chart.component.stub.ts +0 -3
- package/src/lib/testing/stubs/map-legend-content.stub.ts +0 -16
- package/src/lib/testing/stubs/map-legend.component.stub.ts +0 -10
- package/src/lib/testing/stubs/map-primary-marks.stub.ts +0 -16
- package/src/lib/testing/stubs/ordinal-axis.stub.ts +0 -18
- package/src/lib/testing/stubs/primary-marks.stub.ts +0 -18
- package/src/lib/testing/stubs/quantitative-axis.stub.ts +0 -18
- package/src/lib/testing/stubs/services/main.service.stub.ts +0 -5
- package/src/lib/testing/stubs/services/utilities.service.stub.ts +0 -7
- package/src/lib/testing/stubs/stacked-area.component.stub.ts +0 -13
- package/src/lib/testing/stubs/x-axis.stub.ts +0 -10
- package/src/lib/testing/stubs/xy-axis.class.stub.ts +0 -20
- package/src/lib/testing/stubs/xy-axis.stub.ts +0 -44
- package/src/lib/testing/stubs/xy-chart.component.stub.ts +0 -5
- package/src/lib/testing/stubs/xy-data-marks.stub.ts +0 -15
- package/src/lib/testing/stubs/y-axis.stub.ts +0 -15
- package/src/lib/tooltips/config/tooltip.ts +0 -11
- package/src/lib/tooltips/html-tooltip/config/html-tooltip-builder.ts +0 -134
- package/src/lib/tooltips/html-tooltip/config/html-tooltip-config.ts +0 -21
- package/src/lib/tooltips/html-tooltip/config/html-tooltip-options.ts +0 -12
- package/src/lib/tooltips/html-tooltip/config/position/tooltip-position-builder.ts +0 -191
- package/src/lib/tooltips/html-tooltip/config/position/tooltip-position.ts +0 -42
- package/src/lib/tooltips/html-tooltip/config/size/tooltip-size-builder.ts +0 -75
- package/src/lib/tooltips/html-tooltip/config/size/tooltip-size-options.ts +0 -8
- package/src/lib/tooltips/html-tooltip/config/size/tooltip-size.ts +0 -15
- package/src/lib/tooltips/html-tooltip/html-tooltip.directive.spec.ts +0 -537
- package/src/lib/tooltips/html-tooltip/html-tooltip.directive.ts +0 -210
- package/src/lib/tooltips/html-tooltip/html-tooltip.module.ts +0 -16
- package/src/lib/tooltips/html-tooltip/tooltip-triangle/tooltip-triangle.component.html +0 -41
- package/src/lib/tooltips/html-tooltip/tooltip-triangle/tooltip-triangle.component.scss +0 -63
- package/src/lib/tooltips/html-tooltip/tooltip-triangle/tooltip-triangle.component.ts +0 -19
- package/src/lib/tooltips/index.ts +0 -11
- package/src/lib/tooltips/svg-tooltip/config/svg-tooltip.ts +0 -5
- package/src/lib/xy-background/index.ts +0 -2
- package/src/lib/xy-background/xy-background.component.html +0 -10
- package/src/lib/xy-background/xy-background.component.scss +0 -0
- package/src/lib/xy-background/xy-background.component.spec.ts +0 -24
- package/src/lib/xy-background/xy-background.component.ts +0 -19
- package/src/lib/xy-background/xy-background.module.ts +0 -8
- package/src/public-api.ts +0 -26
- package/src/test.ts +0 -15
- package/tsconfig.doc.json +0 -4
- package/tsconfig.json +0 -20
- package/tsconfig.lib.json +0 -23
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -10
|
@@ -1,954 +0,0 @@
|
|
|
1
|
-
import { ValueExtent } from '../types/values';
|
|
2
|
-
import { ValueUtilities } from './values';
|
|
3
|
-
|
|
4
|
-
describe('ValueUtilities', () => {
|
|
5
|
-
describe('integration: getValueRoundedToNSignificantDigits', () => {
|
|
6
|
-
let sigFigures: number;
|
|
7
|
-
let value: number;
|
|
8
|
-
let valueExtent: ValueExtent;
|
|
9
|
-
describe('value is large/positive integer, test with different sigFigures', () => {
|
|
10
|
-
beforeEach(() => {
|
|
11
|
-
value = 1234567;
|
|
12
|
-
});
|
|
13
|
-
describe('if domain type is max', () => {
|
|
14
|
-
beforeEach(() => {
|
|
15
|
-
valueExtent = ValueExtent.max;
|
|
16
|
-
});
|
|
17
|
-
it('returns the correct value if sigFigures is 1', () => {
|
|
18
|
-
sigFigures = 1;
|
|
19
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
20
|
-
value,
|
|
21
|
-
sigFigures,
|
|
22
|
-
valueExtent
|
|
23
|
-
);
|
|
24
|
-
expect(result).toEqual(2000000);
|
|
25
|
-
});
|
|
26
|
-
it('returns the correct value if sigFigures is 2', () => {
|
|
27
|
-
sigFigures = 2;
|
|
28
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
29
|
-
value,
|
|
30
|
-
sigFigures,
|
|
31
|
-
valueExtent
|
|
32
|
-
);
|
|
33
|
-
expect(result).toEqual(1300000);
|
|
34
|
-
});
|
|
35
|
-
it('returns the correct value if sigFigures is 4', () => {
|
|
36
|
-
sigFigures = 4;
|
|
37
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
38
|
-
value,
|
|
39
|
-
sigFigures,
|
|
40
|
-
valueExtent
|
|
41
|
-
);
|
|
42
|
-
expect(result).toEqual(1235000);
|
|
43
|
-
});
|
|
44
|
-
it('returns the correct value if the last rounded sig digit is 9', () => {
|
|
45
|
-
value = 5998877;
|
|
46
|
-
sigFigures = 3;
|
|
47
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
48
|
-
value,
|
|
49
|
-
sigFigures,
|
|
50
|
-
valueExtent
|
|
51
|
-
);
|
|
52
|
-
expect(result).toEqual(6000000);
|
|
53
|
-
});
|
|
54
|
-
it('returns the correct value if the last rounded sig digit is 9 and the first digit is rounded up', () => {
|
|
55
|
-
value = 9998877;
|
|
56
|
-
sigFigures = 3;
|
|
57
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
58
|
-
value,
|
|
59
|
-
sigFigures,
|
|
60
|
-
valueExtent
|
|
61
|
-
);
|
|
62
|
-
expect(result).toEqual(10000000);
|
|
63
|
-
});
|
|
64
|
-
it('returns the correct value if sigFigures is 0', () => {
|
|
65
|
-
sigFigures = 0;
|
|
66
|
-
expect(function () {
|
|
67
|
-
ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
68
|
-
value,
|
|
69
|
-
sigFigures,
|
|
70
|
-
valueExtent
|
|
71
|
-
);
|
|
72
|
-
}).toThrow(
|
|
73
|
-
new Error('sigFigures must be greater than or equal to 1')
|
|
74
|
-
);
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
describe('if domain type is min', () => {
|
|
78
|
-
beforeEach(() => {
|
|
79
|
-
valueExtent = ValueExtent.min;
|
|
80
|
-
});
|
|
81
|
-
it('returns the correct value if sigFigures is 1', () => {
|
|
82
|
-
sigFigures = 1;
|
|
83
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
84
|
-
value,
|
|
85
|
-
sigFigures,
|
|
86
|
-
valueExtent
|
|
87
|
-
);
|
|
88
|
-
expect(result).toEqual(1000000);
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
it('returns the correct value if sigFigures is 2', () => {
|
|
92
|
-
sigFigures = 2;
|
|
93
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
94
|
-
value,
|
|
95
|
-
sigFigures,
|
|
96
|
-
valueExtent
|
|
97
|
-
);
|
|
98
|
-
expect(result).toEqual(1200000);
|
|
99
|
-
});
|
|
100
|
-
it('returns the correct value if sigFigures is 4', () => {
|
|
101
|
-
sigFigures = 4;
|
|
102
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
103
|
-
value,
|
|
104
|
-
sigFigures,
|
|
105
|
-
valueExtent
|
|
106
|
-
);
|
|
107
|
-
expect(result).toEqual(1234000);
|
|
108
|
-
});
|
|
109
|
-
it('returns the correct value if the last rounded sig digit is 9', () => {
|
|
110
|
-
value = 5998877;
|
|
111
|
-
sigFigures = 3;
|
|
112
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
113
|
-
value,
|
|
114
|
-
sigFigures,
|
|
115
|
-
valueExtent
|
|
116
|
-
);
|
|
117
|
-
expect(result).toEqual(5990000);
|
|
118
|
-
});
|
|
119
|
-
it('returns the correct value if the last rounded sig digit is 9 and the first digit is rounded up', () => {
|
|
120
|
-
value = 9998877;
|
|
121
|
-
sigFigures = 3;
|
|
122
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
123
|
-
value,
|
|
124
|
-
sigFigures,
|
|
125
|
-
valueExtent
|
|
126
|
-
);
|
|
127
|
-
expect(result).toEqual(9990000);
|
|
128
|
-
});
|
|
129
|
-
it('returns the correct value if sigFigures is 0', () => {
|
|
130
|
-
sigFigures = 0;
|
|
131
|
-
expect(function () {
|
|
132
|
-
ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
133
|
-
value,
|
|
134
|
-
sigFigures,
|
|
135
|
-
valueExtent
|
|
136
|
-
);
|
|
137
|
-
}).toThrow(
|
|
138
|
-
new Error('sigFigures must be greater than or equal to 1')
|
|
139
|
-
);
|
|
140
|
-
});
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
describe('value is large/negative integer, test with different sigFigures', () => {
|
|
145
|
-
beforeEach(() => {
|
|
146
|
-
value = -1234567;
|
|
147
|
-
});
|
|
148
|
-
describe('if domain type is max', () => {
|
|
149
|
-
beforeEach(() => {
|
|
150
|
-
valueExtent = ValueExtent.max;
|
|
151
|
-
});
|
|
152
|
-
it('returns the correct value if sigFigures is 1', () => {
|
|
153
|
-
sigFigures = 1;
|
|
154
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
155
|
-
value,
|
|
156
|
-
sigFigures,
|
|
157
|
-
valueExtent
|
|
158
|
-
);
|
|
159
|
-
expect(result).toEqual(-1000000);
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
it('returns the correct value if sigFigures is 2', () => {
|
|
163
|
-
sigFigures = 2;
|
|
164
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
165
|
-
value,
|
|
166
|
-
sigFigures,
|
|
167
|
-
valueExtent
|
|
168
|
-
);
|
|
169
|
-
expect(result).toEqual(-1200000);
|
|
170
|
-
});
|
|
171
|
-
it('returns the correct value if sigFigures is 4', () => {
|
|
172
|
-
sigFigures = 4;
|
|
173
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
174
|
-
value,
|
|
175
|
-
sigFigures,
|
|
176
|
-
valueExtent
|
|
177
|
-
);
|
|
178
|
-
expect(result).toEqual(-1234000);
|
|
179
|
-
});
|
|
180
|
-
it('returns the correct value if the last rounded sig digit is 9', () => {
|
|
181
|
-
value = -5998877;
|
|
182
|
-
sigFigures = 3;
|
|
183
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
184
|
-
value,
|
|
185
|
-
sigFigures,
|
|
186
|
-
valueExtent
|
|
187
|
-
);
|
|
188
|
-
expect(result).toEqual(-5990000);
|
|
189
|
-
});
|
|
190
|
-
it('returns the correct value if the last rounded sig digit is 9 and the first digit is rounded up', () => {
|
|
191
|
-
value = -9998877;
|
|
192
|
-
sigFigures = 3;
|
|
193
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
194
|
-
value,
|
|
195
|
-
sigFigures,
|
|
196
|
-
valueExtent
|
|
197
|
-
);
|
|
198
|
-
expect(result).toEqual(-9990000);
|
|
199
|
-
});
|
|
200
|
-
it('returns the correct value if sigFigures is 0', () => {
|
|
201
|
-
sigFigures = 0;
|
|
202
|
-
expect(function () {
|
|
203
|
-
ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
204
|
-
value,
|
|
205
|
-
sigFigures,
|
|
206
|
-
valueExtent
|
|
207
|
-
);
|
|
208
|
-
}).toThrow(
|
|
209
|
-
new Error('sigFigures must be greater than or equal to 1')
|
|
210
|
-
);
|
|
211
|
-
});
|
|
212
|
-
});
|
|
213
|
-
describe('if domain type is min', () => {
|
|
214
|
-
beforeEach(() => {
|
|
215
|
-
valueExtent = ValueExtent.min;
|
|
216
|
-
});
|
|
217
|
-
it('returns the correct value if sigFigures is 1', () => {
|
|
218
|
-
sigFigures = 1;
|
|
219
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
220
|
-
value,
|
|
221
|
-
sigFigures,
|
|
222
|
-
valueExtent
|
|
223
|
-
);
|
|
224
|
-
expect(result).toEqual(-2000000);
|
|
225
|
-
});
|
|
226
|
-
|
|
227
|
-
it('returns the correct value if sigFigures is 2', () => {
|
|
228
|
-
sigFigures = 2;
|
|
229
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
230
|
-
value,
|
|
231
|
-
sigFigures,
|
|
232
|
-
valueExtent
|
|
233
|
-
);
|
|
234
|
-
expect(result).toEqual(-1300000);
|
|
235
|
-
});
|
|
236
|
-
it('returns the correct value if sigFigures is 4', () => {
|
|
237
|
-
sigFigures = 4;
|
|
238
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
239
|
-
value,
|
|
240
|
-
sigFigures,
|
|
241
|
-
valueExtent
|
|
242
|
-
);
|
|
243
|
-
expect(result).toEqual(-1235000);
|
|
244
|
-
});
|
|
245
|
-
it('returns the correct value if the last rounded sig digit is 9', () => {
|
|
246
|
-
value = -5998877;
|
|
247
|
-
sigFigures = 3;
|
|
248
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
249
|
-
value,
|
|
250
|
-
sigFigures,
|
|
251
|
-
valueExtent
|
|
252
|
-
);
|
|
253
|
-
expect(result).toEqual(-6000000);
|
|
254
|
-
});
|
|
255
|
-
it('returns the correct value if the last rounded sig digit is 9 and the first digit is rounded up', () => {
|
|
256
|
-
value = -9998877;
|
|
257
|
-
sigFigures = 3;
|
|
258
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
259
|
-
value,
|
|
260
|
-
sigFigures,
|
|
261
|
-
valueExtent
|
|
262
|
-
);
|
|
263
|
-
expect(result).toEqual(-10000000);
|
|
264
|
-
});
|
|
265
|
-
it('returns the correct value if sigFigures is 0', () => {
|
|
266
|
-
sigFigures = 0;
|
|
267
|
-
expect(function () {
|
|
268
|
-
ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
269
|
-
value,
|
|
270
|
-
sigFigures,
|
|
271
|
-
valueExtent
|
|
272
|
-
);
|
|
273
|
-
}).toThrow(
|
|
274
|
-
new Error('sigFigures must be greater than or equal to 1')
|
|
275
|
-
);
|
|
276
|
-
});
|
|
277
|
-
});
|
|
278
|
-
});
|
|
279
|
-
|
|
280
|
-
describe('value is large/positive decimal, test with different sigFigures', () => {
|
|
281
|
-
beforeEach(() => {
|
|
282
|
-
value = 1234.5678;
|
|
283
|
-
});
|
|
284
|
-
describe('if the domain type is max', () => {
|
|
285
|
-
beforeEach(() => {
|
|
286
|
-
valueExtent = ValueExtent.max;
|
|
287
|
-
});
|
|
288
|
-
it('returns the correct value if sigFigures is 3', () => {
|
|
289
|
-
sigFigures = 3;
|
|
290
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
291
|
-
value,
|
|
292
|
-
sigFigures,
|
|
293
|
-
valueExtent
|
|
294
|
-
);
|
|
295
|
-
expect(result).toEqual(1240);
|
|
296
|
-
});
|
|
297
|
-
|
|
298
|
-
it('returns the correct value if sigFigures is 6', () => {
|
|
299
|
-
sigFigures = 6;
|
|
300
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
301
|
-
value,
|
|
302
|
-
sigFigures,
|
|
303
|
-
valueExtent
|
|
304
|
-
);
|
|
305
|
-
expect(result).toEqual(1234.57);
|
|
306
|
-
});
|
|
307
|
-
});
|
|
308
|
-
describe('if the domain type is min', () => {
|
|
309
|
-
beforeEach(() => {
|
|
310
|
-
valueExtent = ValueExtent.min;
|
|
311
|
-
});
|
|
312
|
-
it('returns the correct value if sigFigures is 3', () => {
|
|
313
|
-
sigFigures = 3;
|
|
314
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
315
|
-
value,
|
|
316
|
-
sigFigures,
|
|
317
|
-
valueExtent
|
|
318
|
-
);
|
|
319
|
-
expect(result).toEqual(1230);
|
|
320
|
-
});
|
|
321
|
-
|
|
322
|
-
it('returns the correct value if sigFigures is 6', () => {
|
|
323
|
-
sigFigures = 6;
|
|
324
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
325
|
-
value,
|
|
326
|
-
sigFigures,
|
|
327
|
-
valueExtent
|
|
328
|
-
);
|
|
329
|
-
expect(result).toEqual(1234.56);
|
|
330
|
-
});
|
|
331
|
-
});
|
|
332
|
-
});
|
|
333
|
-
|
|
334
|
-
describe('value is large/negative decimal, test with different sigFigures', () => {
|
|
335
|
-
beforeEach(() => {
|
|
336
|
-
value = -1234.5678;
|
|
337
|
-
});
|
|
338
|
-
describe('if the domain type is max', () => {
|
|
339
|
-
beforeEach(() => {
|
|
340
|
-
valueExtent = ValueExtent.max;
|
|
341
|
-
});
|
|
342
|
-
it('returns the correct value if sigFigures is 3', () => {
|
|
343
|
-
sigFigures = 3;
|
|
344
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
345
|
-
value,
|
|
346
|
-
sigFigures,
|
|
347
|
-
valueExtent
|
|
348
|
-
);
|
|
349
|
-
expect(result).toEqual(-1230);
|
|
350
|
-
});
|
|
351
|
-
|
|
352
|
-
it('returns the correct value if sigFigures is 6', () => {
|
|
353
|
-
sigFigures = 6;
|
|
354
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
355
|
-
value,
|
|
356
|
-
sigFigures,
|
|
357
|
-
valueExtent
|
|
358
|
-
);
|
|
359
|
-
expect(result).toEqual(-1234.56);
|
|
360
|
-
});
|
|
361
|
-
});
|
|
362
|
-
describe('if the domain type is min', () => {
|
|
363
|
-
beforeEach(() => {
|
|
364
|
-
valueExtent = ValueExtent.min;
|
|
365
|
-
});
|
|
366
|
-
it('returns the correct value if sigFigures is 3', () => {
|
|
367
|
-
sigFigures = 3;
|
|
368
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
369
|
-
value,
|
|
370
|
-
sigFigures,
|
|
371
|
-
valueExtent
|
|
372
|
-
);
|
|
373
|
-
expect(result).toEqual(-1240);
|
|
374
|
-
});
|
|
375
|
-
|
|
376
|
-
it('returns the correct value if sigFigures is 6', () => {
|
|
377
|
-
sigFigures = 6;
|
|
378
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
379
|
-
value,
|
|
380
|
-
sigFigures,
|
|
381
|
-
valueExtent
|
|
382
|
-
);
|
|
383
|
-
expect(result).toEqual(-1234.57);
|
|
384
|
-
});
|
|
385
|
-
});
|
|
386
|
-
});
|
|
387
|
-
|
|
388
|
-
describe('value is small/positive integer, test with different sigFigures', () => {
|
|
389
|
-
beforeEach(() => {
|
|
390
|
-
value = 1;
|
|
391
|
-
});
|
|
392
|
-
describe('if the domain type is max', () => {
|
|
393
|
-
beforeEach(() => {
|
|
394
|
-
valueExtent = ValueExtent.max;
|
|
395
|
-
});
|
|
396
|
-
it('returns the correct value if sigFigures is less than or equal to length of value', () => {
|
|
397
|
-
sigFigures = 1;
|
|
398
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
399
|
-
value,
|
|
400
|
-
sigFigures,
|
|
401
|
-
valueExtent
|
|
402
|
-
);
|
|
403
|
-
expect(result).toEqual(2);
|
|
404
|
-
});
|
|
405
|
-
|
|
406
|
-
it('returns the correct value if sigFigures is greater than length of value', () => {
|
|
407
|
-
sigFigures = 4;
|
|
408
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
409
|
-
value,
|
|
410
|
-
sigFigures,
|
|
411
|
-
valueExtent
|
|
412
|
-
);
|
|
413
|
-
expect(result).toEqual(2);
|
|
414
|
-
});
|
|
415
|
-
});
|
|
416
|
-
describe('if the domain type is min', () => {
|
|
417
|
-
beforeEach(() => {
|
|
418
|
-
valueExtent = ValueExtent.min;
|
|
419
|
-
});
|
|
420
|
-
it('returns the correct value if sigFigures is less than or equal to length of value', () => {
|
|
421
|
-
sigFigures = 1;
|
|
422
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
423
|
-
value,
|
|
424
|
-
sigFigures,
|
|
425
|
-
valueExtent
|
|
426
|
-
);
|
|
427
|
-
expect(result).toEqual(1);
|
|
428
|
-
});
|
|
429
|
-
|
|
430
|
-
it('returns the correct value if sigFigures is greater than length of value', () => {
|
|
431
|
-
sigFigures = 4;
|
|
432
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
433
|
-
value,
|
|
434
|
-
sigFigures,
|
|
435
|
-
valueExtent
|
|
436
|
-
);
|
|
437
|
-
expect(result).toEqual(1);
|
|
438
|
-
});
|
|
439
|
-
});
|
|
440
|
-
});
|
|
441
|
-
|
|
442
|
-
describe('value is small/negative integer, test with different sigFigures', () => {
|
|
443
|
-
beforeEach(() => {
|
|
444
|
-
value = -1;
|
|
445
|
-
});
|
|
446
|
-
describe('if the domain type is max', () => {
|
|
447
|
-
beforeEach(() => {
|
|
448
|
-
valueExtent = ValueExtent.max;
|
|
449
|
-
});
|
|
450
|
-
it('returns the correct value if sigFigures is less than or equal to length of value', () => {
|
|
451
|
-
sigFigures = 1;
|
|
452
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
453
|
-
value,
|
|
454
|
-
sigFigures,
|
|
455
|
-
valueExtent
|
|
456
|
-
);
|
|
457
|
-
expect(result).toEqual(-1);
|
|
458
|
-
});
|
|
459
|
-
|
|
460
|
-
it('returns the correct value if sigFigures is greater than length of value', () => {
|
|
461
|
-
sigFigures = 4;
|
|
462
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
463
|
-
value,
|
|
464
|
-
sigFigures,
|
|
465
|
-
valueExtent
|
|
466
|
-
);
|
|
467
|
-
expect(result).toEqual(-1);
|
|
468
|
-
});
|
|
469
|
-
});
|
|
470
|
-
describe('if the domain type is min', () => {
|
|
471
|
-
beforeEach(() => {
|
|
472
|
-
valueExtent = ValueExtent.min;
|
|
473
|
-
});
|
|
474
|
-
it('returns the correct value if sigFigures is less than or equal to length of value', () => {
|
|
475
|
-
sigFigures = 1;
|
|
476
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
477
|
-
value,
|
|
478
|
-
sigFigures,
|
|
479
|
-
valueExtent
|
|
480
|
-
);
|
|
481
|
-
expect(result).toEqual(-2);
|
|
482
|
-
});
|
|
483
|
-
|
|
484
|
-
it('returns the correct value if sigFigures is greater than length of value', () => {
|
|
485
|
-
sigFigures = 4;
|
|
486
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
487
|
-
value,
|
|
488
|
-
sigFigures,
|
|
489
|
-
valueExtent
|
|
490
|
-
);
|
|
491
|
-
expect(result).toEqual(-2);
|
|
492
|
-
});
|
|
493
|
-
});
|
|
494
|
-
});
|
|
495
|
-
|
|
496
|
-
describe('value is positive decimal, < 100 and > 10, test with different sigFigures', () => {
|
|
497
|
-
beforeEach(() => {
|
|
498
|
-
value = 15.678;
|
|
499
|
-
});
|
|
500
|
-
describe('if the domain type is max', () => {
|
|
501
|
-
beforeEach(() => {
|
|
502
|
-
valueExtent = ValueExtent.max;
|
|
503
|
-
});
|
|
504
|
-
it('returns the correct value if sigFigures is 2', () => {
|
|
505
|
-
sigFigures = 2;
|
|
506
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
507
|
-
value,
|
|
508
|
-
sigFigures,
|
|
509
|
-
valueExtent
|
|
510
|
-
);
|
|
511
|
-
expect(result).toEqual(16);
|
|
512
|
-
});
|
|
513
|
-
|
|
514
|
-
it('returns the correct value if sigFigures is 3', () => {
|
|
515
|
-
sigFigures = 3;
|
|
516
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
517
|
-
value,
|
|
518
|
-
sigFigures,
|
|
519
|
-
valueExtent
|
|
520
|
-
);
|
|
521
|
-
expect(result).toEqual(15.7);
|
|
522
|
-
});
|
|
523
|
-
});
|
|
524
|
-
describe('if the domain type is min', () => {
|
|
525
|
-
beforeEach(() => {
|
|
526
|
-
valueExtent = ValueExtent.min;
|
|
527
|
-
});
|
|
528
|
-
it('returns the correct value if sigFigures is 2', () => {
|
|
529
|
-
sigFigures = 2;
|
|
530
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
531
|
-
value,
|
|
532
|
-
sigFigures,
|
|
533
|
-
valueExtent
|
|
534
|
-
);
|
|
535
|
-
expect(result).toEqual(15);
|
|
536
|
-
});
|
|
537
|
-
|
|
538
|
-
it('returns the correct value if sigFigures is 3', () => {
|
|
539
|
-
sigFigures = 3;
|
|
540
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
541
|
-
value,
|
|
542
|
-
sigFigures,
|
|
543
|
-
valueExtent
|
|
544
|
-
);
|
|
545
|
-
expect(result).toEqual(15.6);
|
|
546
|
-
});
|
|
547
|
-
});
|
|
548
|
-
});
|
|
549
|
-
|
|
550
|
-
describe('value is negative decimal, > -100 and < -10, test with different sigFigures', () => {
|
|
551
|
-
beforeEach(() => {
|
|
552
|
-
value = -15.678;
|
|
553
|
-
});
|
|
554
|
-
describe('if the domain type is max', () => {
|
|
555
|
-
beforeEach(() => {
|
|
556
|
-
valueExtent = ValueExtent.max;
|
|
557
|
-
});
|
|
558
|
-
it('returns the correct value if sigFigures is 2', () => {
|
|
559
|
-
sigFigures = 2;
|
|
560
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
561
|
-
value,
|
|
562
|
-
sigFigures,
|
|
563
|
-
valueExtent
|
|
564
|
-
);
|
|
565
|
-
expect(result).toEqual(-15);
|
|
566
|
-
});
|
|
567
|
-
|
|
568
|
-
it('returns the correct value if sigFigures is 3', () => {
|
|
569
|
-
sigFigures = 3;
|
|
570
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
571
|
-
value,
|
|
572
|
-
sigFigures,
|
|
573
|
-
valueExtent
|
|
574
|
-
);
|
|
575
|
-
expect(result).toEqual(-15.6);
|
|
576
|
-
});
|
|
577
|
-
});
|
|
578
|
-
describe('if the domain type is min', () => {
|
|
579
|
-
beforeEach(() => {
|
|
580
|
-
valueExtent = ValueExtent.min;
|
|
581
|
-
});
|
|
582
|
-
it('returns the correct value if sigFigures is 2', () => {
|
|
583
|
-
sigFigures = 2;
|
|
584
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
585
|
-
value,
|
|
586
|
-
sigFigures,
|
|
587
|
-
valueExtent
|
|
588
|
-
);
|
|
589
|
-
expect(result).toEqual(-16);
|
|
590
|
-
});
|
|
591
|
-
|
|
592
|
-
it('returns the correct value if sigFigures is 3', () => {
|
|
593
|
-
sigFigures = 3;
|
|
594
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
595
|
-
value,
|
|
596
|
-
sigFigures,
|
|
597
|
-
valueExtent
|
|
598
|
-
);
|
|
599
|
-
expect(result).toEqual(-15.7);
|
|
600
|
-
});
|
|
601
|
-
});
|
|
602
|
-
});
|
|
603
|
-
|
|
604
|
-
describe('value is small/positive decimal, < 10 and > 1, test with different sigFigures', () => {
|
|
605
|
-
beforeEach(() => {
|
|
606
|
-
value = 1.5678;
|
|
607
|
-
});
|
|
608
|
-
describe('if the domain type is max', () => {
|
|
609
|
-
beforeEach(() => {
|
|
610
|
-
valueExtent = ValueExtent.max;
|
|
611
|
-
});
|
|
612
|
-
it('returns the correct value if sigFigures is 2', () => {
|
|
613
|
-
sigFigures = 2;
|
|
614
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
615
|
-
value,
|
|
616
|
-
sigFigures,
|
|
617
|
-
valueExtent
|
|
618
|
-
);
|
|
619
|
-
expect(result).toEqual(1.6);
|
|
620
|
-
});
|
|
621
|
-
|
|
622
|
-
it('returns the correct value if sigFigures is 3', () => {
|
|
623
|
-
sigFigures = 3;
|
|
624
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
625
|
-
value,
|
|
626
|
-
sigFigures,
|
|
627
|
-
valueExtent
|
|
628
|
-
);
|
|
629
|
-
expect(result).toEqual(1.57);
|
|
630
|
-
});
|
|
631
|
-
});
|
|
632
|
-
describe('if the domain type is min', () => {
|
|
633
|
-
beforeEach(() => {
|
|
634
|
-
valueExtent = ValueExtent.min;
|
|
635
|
-
});
|
|
636
|
-
it('returns the correct value if sigFigures is 2', () => {
|
|
637
|
-
sigFigures = 2;
|
|
638
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
639
|
-
value,
|
|
640
|
-
sigFigures,
|
|
641
|
-
valueExtent
|
|
642
|
-
);
|
|
643
|
-
expect(result).toEqual(1.5);
|
|
644
|
-
});
|
|
645
|
-
|
|
646
|
-
it('returns the correct value if sigFigures is 3', () => {
|
|
647
|
-
sigFigures = 3;
|
|
648
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
649
|
-
value,
|
|
650
|
-
sigFigures,
|
|
651
|
-
valueExtent
|
|
652
|
-
);
|
|
653
|
-
expect(result).toEqual(1.56);
|
|
654
|
-
});
|
|
655
|
-
});
|
|
656
|
-
});
|
|
657
|
-
|
|
658
|
-
describe('value is small/negative decimal, < 10 and > 1, test with different sigFigures', () => {
|
|
659
|
-
beforeEach(() => {
|
|
660
|
-
value = -1.5678;
|
|
661
|
-
});
|
|
662
|
-
describe('if the domain type is max', () => {
|
|
663
|
-
beforeEach(() => {
|
|
664
|
-
valueExtent = ValueExtent.max;
|
|
665
|
-
});
|
|
666
|
-
it('returns the correct value if sigFigures is 2', () => {
|
|
667
|
-
sigFigures = 2;
|
|
668
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
669
|
-
value,
|
|
670
|
-
sigFigures,
|
|
671
|
-
valueExtent
|
|
672
|
-
);
|
|
673
|
-
expect(result).toEqual(-1.5);
|
|
674
|
-
});
|
|
675
|
-
|
|
676
|
-
it('returns the correct value if sigFigures is 3', () => {
|
|
677
|
-
sigFigures = 3;
|
|
678
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
679
|
-
value,
|
|
680
|
-
sigFigures,
|
|
681
|
-
valueExtent
|
|
682
|
-
);
|
|
683
|
-
expect(result).toEqual(-1.56);
|
|
684
|
-
});
|
|
685
|
-
});
|
|
686
|
-
describe('if the domain type is min', () => {
|
|
687
|
-
beforeEach(() => {
|
|
688
|
-
valueExtent = ValueExtent.min;
|
|
689
|
-
});
|
|
690
|
-
it('returns the correct value if sigFigures is 2', () => {
|
|
691
|
-
sigFigures = 2;
|
|
692
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
693
|
-
value,
|
|
694
|
-
sigFigures,
|
|
695
|
-
valueExtent
|
|
696
|
-
);
|
|
697
|
-
expect(result).toEqual(-1.6);
|
|
698
|
-
});
|
|
699
|
-
|
|
700
|
-
it('returns the correct value if sigFigures is 3', () => {
|
|
701
|
-
sigFigures = 3;
|
|
702
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
703
|
-
value,
|
|
704
|
-
sigFigures,
|
|
705
|
-
valueExtent
|
|
706
|
-
);
|
|
707
|
-
expect(result).toEqual(-1.57);
|
|
708
|
-
});
|
|
709
|
-
});
|
|
710
|
-
});
|
|
711
|
-
|
|
712
|
-
describe('value is small decimal, < 1, test with different sigFigures', () => {
|
|
713
|
-
beforeEach(() => {
|
|
714
|
-
value = 0.0010678;
|
|
715
|
-
});
|
|
716
|
-
describe('if the domain type is max', () => {
|
|
717
|
-
beforeEach(() => {
|
|
718
|
-
valueExtent = ValueExtent.max;
|
|
719
|
-
});
|
|
720
|
-
it('returns the correct value if sigFigures is 2', () => {
|
|
721
|
-
sigFigures = 2;
|
|
722
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
723
|
-
value,
|
|
724
|
-
sigFigures,
|
|
725
|
-
valueExtent
|
|
726
|
-
);
|
|
727
|
-
expect(result).toEqual(0.0011);
|
|
728
|
-
});
|
|
729
|
-
|
|
730
|
-
it('returns the correct value if sigFigures is 4', () => {
|
|
731
|
-
sigFigures = 4;
|
|
732
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
733
|
-
value,
|
|
734
|
-
sigFigures,
|
|
735
|
-
valueExtent
|
|
736
|
-
);
|
|
737
|
-
expect(result).toEqual(0.001068);
|
|
738
|
-
});
|
|
739
|
-
|
|
740
|
-
it('returns the correct value if sigFigures is 1 and sig value ends with 9', () => {
|
|
741
|
-
sigFigures = 1;
|
|
742
|
-
value = 0.009;
|
|
743
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
744
|
-
value,
|
|
745
|
-
sigFigures,
|
|
746
|
-
valueExtent
|
|
747
|
-
);
|
|
748
|
-
expect(result).toEqual(0.01);
|
|
749
|
-
});
|
|
750
|
-
|
|
751
|
-
it('returns the correct value if sigFigures is 2 and sig value ends with 99', () => {
|
|
752
|
-
sigFigures = 2;
|
|
753
|
-
value = 0.099;
|
|
754
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
755
|
-
value,
|
|
756
|
-
sigFigures,
|
|
757
|
-
valueExtent
|
|
758
|
-
);
|
|
759
|
-
expect(result).toEqual(0.1);
|
|
760
|
-
});
|
|
761
|
-
|
|
762
|
-
it('returns the correct value if sigFigures is 2 and value is 0.9', () => {
|
|
763
|
-
sigFigures = 2;
|
|
764
|
-
value = 0.9;
|
|
765
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
766
|
-
value,
|
|
767
|
-
sigFigures,
|
|
768
|
-
valueExtent
|
|
769
|
-
);
|
|
770
|
-
expect(result).toEqual(1);
|
|
771
|
-
});
|
|
772
|
-
});
|
|
773
|
-
|
|
774
|
-
describe('if the domain type is min', () => {
|
|
775
|
-
beforeEach(() => {
|
|
776
|
-
valueExtent = ValueExtent.min;
|
|
777
|
-
});
|
|
778
|
-
it('returns the correct value if sigFigures is 2', () => {
|
|
779
|
-
sigFigures = 2;
|
|
780
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
781
|
-
value,
|
|
782
|
-
sigFigures,
|
|
783
|
-
valueExtent
|
|
784
|
-
);
|
|
785
|
-
expect(result).toEqual(0.001);
|
|
786
|
-
});
|
|
787
|
-
|
|
788
|
-
it('returns the correct value if sigFigures is 4', () => {
|
|
789
|
-
sigFigures = 4;
|
|
790
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
791
|
-
value,
|
|
792
|
-
sigFigures,
|
|
793
|
-
valueExtent
|
|
794
|
-
);
|
|
795
|
-
expect(result).toEqual(0.001067);
|
|
796
|
-
});
|
|
797
|
-
|
|
798
|
-
it('returns the correct value if sigFigures is 1 and sig value ends with 9', () => {
|
|
799
|
-
sigFigures = 1;
|
|
800
|
-
value = 0.009;
|
|
801
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
802
|
-
value,
|
|
803
|
-
sigFigures,
|
|
804
|
-
valueExtent
|
|
805
|
-
);
|
|
806
|
-
expect(result).toEqual(0);
|
|
807
|
-
});
|
|
808
|
-
|
|
809
|
-
it('returns the correct value if sigFigures is 2 and sig value ends with 99', () => {
|
|
810
|
-
sigFigures = 2;
|
|
811
|
-
value = 0.099;
|
|
812
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
813
|
-
value,
|
|
814
|
-
sigFigures,
|
|
815
|
-
valueExtent
|
|
816
|
-
);
|
|
817
|
-
expect(result).toEqual(0);
|
|
818
|
-
});
|
|
819
|
-
|
|
820
|
-
it('returns the correct value if sigFigures is 2 and value is 0.9', () => {
|
|
821
|
-
sigFigures = 2;
|
|
822
|
-
value = 0.9;
|
|
823
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
824
|
-
value,
|
|
825
|
-
sigFigures,
|
|
826
|
-
valueExtent
|
|
827
|
-
);
|
|
828
|
-
expect(result).toEqual(0);
|
|
829
|
-
});
|
|
830
|
-
});
|
|
831
|
-
});
|
|
832
|
-
|
|
833
|
-
describe('value is small decimal, > -1, test with different sigFigures', () => {
|
|
834
|
-
beforeEach(() => {
|
|
835
|
-
value = -0.0010678;
|
|
836
|
-
});
|
|
837
|
-
describe('if the domain type is max', () => {
|
|
838
|
-
beforeEach(() => {
|
|
839
|
-
valueExtent = ValueExtent.max;
|
|
840
|
-
});
|
|
841
|
-
it('returns the correct value if sigFigures is 2', () => {
|
|
842
|
-
sigFigures = 2;
|
|
843
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
844
|
-
value,
|
|
845
|
-
sigFigures,
|
|
846
|
-
valueExtent
|
|
847
|
-
);
|
|
848
|
-
expect(result).toEqual(-0.001);
|
|
849
|
-
});
|
|
850
|
-
|
|
851
|
-
it('returns the correct value if sigFigures is 4', () => {
|
|
852
|
-
sigFigures = 4;
|
|
853
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
854
|
-
value,
|
|
855
|
-
sigFigures,
|
|
856
|
-
valueExtent
|
|
857
|
-
);
|
|
858
|
-
expect(result).toEqual(-0.001067);
|
|
859
|
-
});
|
|
860
|
-
|
|
861
|
-
it('returns the correct value if sigFigures is 1 and sig value ends with 9', () => {
|
|
862
|
-
sigFigures = 1;
|
|
863
|
-
value = -0.009;
|
|
864
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
865
|
-
value,
|
|
866
|
-
sigFigures,
|
|
867
|
-
valueExtent
|
|
868
|
-
);
|
|
869
|
-
expect(result).toEqual(0);
|
|
870
|
-
});
|
|
871
|
-
|
|
872
|
-
it('returns the correct value if sigFigures is 2 and sig value ends with 99', () => {
|
|
873
|
-
sigFigures = 2;
|
|
874
|
-
value = -0.099;
|
|
875
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
876
|
-
value,
|
|
877
|
-
sigFigures,
|
|
878
|
-
valueExtent
|
|
879
|
-
);
|
|
880
|
-
expect(result).toEqual(0);
|
|
881
|
-
});
|
|
882
|
-
|
|
883
|
-
it('returns the correct value if sigFigures is 2 and value is 0.9', () => {
|
|
884
|
-
sigFigures = 2;
|
|
885
|
-
value = -0.9;
|
|
886
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
887
|
-
value,
|
|
888
|
-
sigFigures,
|
|
889
|
-
valueExtent
|
|
890
|
-
);
|
|
891
|
-
expect(result).toEqual(0);
|
|
892
|
-
});
|
|
893
|
-
});
|
|
894
|
-
|
|
895
|
-
describe('if the domain type is min', () => {
|
|
896
|
-
beforeEach(() => {
|
|
897
|
-
valueExtent = ValueExtent.min;
|
|
898
|
-
});
|
|
899
|
-
it('returns the correct value if sigFigures is 2', () => {
|
|
900
|
-
sigFigures = 2;
|
|
901
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
902
|
-
value,
|
|
903
|
-
sigFigures,
|
|
904
|
-
valueExtent
|
|
905
|
-
);
|
|
906
|
-
expect(result).toEqual(-0.0011);
|
|
907
|
-
});
|
|
908
|
-
|
|
909
|
-
it('returns the correct value if sigFigures is 4', () => {
|
|
910
|
-
sigFigures = 4;
|
|
911
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
912
|
-
value,
|
|
913
|
-
sigFigures,
|
|
914
|
-
valueExtent
|
|
915
|
-
);
|
|
916
|
-
expect(result).toEqual(-0.001068);
|
|
917
|
-
});
|
|
918
|
-
|
|
919
|
-
it('returns the correct value if sigFigures is 1 and sig value ends with 9', () => {
|
|
920
|
-
sigFigures = 1;
|
|
921
|
-
value = -0.009;
|
|
922
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
923
|
-
value,
|
|
924
|
-
sigFigures,
|
|
925
|
-
valueExtent
|
|
926
|
-
);
|
|
927
|
-
expect(result).toEqual(-0.01);
|
|
928
|
-
});
|
|
929
|
-
|
|
930
|
-
it('returns the correct value if sigFigures is 2 and sig value ends with 99', () => {
|
|
931
|
-
sigFigures = 2;
|
|
932
|
-
value = -0.099;
|
|
933
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
934
|
-
value,
|
|
935
|
-
sigFigures,
|
|
936
|
-
valueExtent
|
|
937
|
-
);
|
|
938
|
-
expect(result).toEqual(-0.1);
|
|
939
|
-
});
|
|
940
|
-
|
|
941
|
-
it('returns the correct value if sigFigures is 2 and value is 0.9', () => {
|
|
942
|
-
sigFigures = 2;
|
|
943
|
-
value = -0.9;
|
|
944
|
-
const result = ValueUtilities.getValueRoundedToNSignificantFigures(
|
|
945
|
-
value,
|
|
946
|
-
sigFigures,
|
|
947
|
-
valueExtent
|
|
948
|
-
);
|
|
949
|
-
expect(result).toEqual(-1);
|
|
950
|
-
});
|
|
951
|
-
});
|
|
952
|
-
});
|
|
953
|
-
});
|
|
954
|
-
});
|