Skip to content

Condition operator '<=' behaves as '<' (equal case dropped) #10

Description

@mejta

Found while building the JS unit test layer.

evaluateCondition in assets/helpers/functions.js:132-133 implements the <= operator as value < expected, dropping the equality case:

case '<=':
  return value < expected;

A condition like { field: 'qty', condition: '<=', value: 10 } therefore evaluates false when qty === 10, hiding/showing the dependent field incorrectly at the boundary.

The current (buggy) behaviour is locked by an explicitly labelled "known quirk" test in tests/js/helpers/functions.test.js, so fixing this is a deliberate, visible change: fix the operator, then update that test to assert the correct boundary behaviour. Check whether any PHP-side condition evaluation mirrors the same logic before closing.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triageMaintainer needs to evaluate this issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions