fix: Change the not condition to exactly match the HA not condition (#2387)

BREAKING CHANGE: Changes the behavior of the `not` condition when there
is more than one condition present. Users who desire the previous
behavior should wrap their conditions in an `and` first.

 - Closes: #2383
This commit is contained in:
Dermot Duffy
2026-03-01 20:39:03 -08:00
committed by GitHub
parent 526acf7688
commit ecc8ecfd7e
3 changed files with 19 additions and 12 deletions
+6 -2
View File
@@ -1317,17 +1317,21 @@ describe('ConditionsManager', () => {
stateManager,
);
// Neither sub-condition is true initially, so `not` passes.
expect(manager.getEvaluation().result).toBeTruthy();
// fullscreen becomes true — any sub-condition being true means `not` fails.
stateManager.setState({ fullscreen: true });
expect(manager.getEvaluation().result).toBeTruthy();
expect(manager.getEvaluation().result).toBeFalsy();
stateManager.setState({ expand: true });
expect(manager.getEvaluation().result).toBeFalsy();
// fullscreen reverts, but expand is still true, so `not` still fails.
stateManager.setState({ fullscreen: false });
expect(manager.getEvaluation().result).toBeTruthy();
expect(manager.getEvaluation().result).toBeFalsy();
// Both sub-conditions are false again, so `not` passes.
stateManager.setState({ expand: false });
expect(manager.getEvaluation().result).toBeTruthy();