Add coexistence checks to all enqueue methods to prevent loading both React and Grid.js assets simultaneously. Changes: - ReactAdmin.php: Only enqueue React assets when ?react=1 - Init.php: Skip Grid.js when React active on admin pages - Form.php, Coupon.php, Access.php: Restore classic assets when ?react=0 - Customer.php, Product.php, License.php: Add coexistence checks Now the toggle between Classic and React versions works correctly. Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
35 lines
1.0 KiB
Markdown
35 lines
1.0 KiB
Markdown
# Suggest using `toBeCalledWith()` or `toHaveBeenCalledWith()` (`prefer-called-with`)
|
|
|
|
<!-- end auto-generated rule header -->
|
|
|
|
The `toBeCalled()` matcher is used to assert that a mock function has been
|
|
called one or more times, without checking the arguments passed. The assertion
|
|
is stronger when arguments are also validated using the `toBeCalledWith()`
|
|
matcher. When some arguments are difficult to check, using generic match like
|
|
`expect.anything()` at least enforces number and position of arguments.
|
|
|
|
This rule warns if the form without argument checking is used, except for `.not`
|
|
enforcing a function has never been called.
|
|
|
|
## Rule details
|
|
|
|
The following patterns are warnings:
|
|
|
|
```js
|
|
expect(someFunction).toBeCalled();
|
|
|
|
expect(someFunction).toHaveBeenCalled();
|
|
```
|
|
|
|
The following patterns are not warnings:
|
|
|
|
```js
|
|
expect(noArgsFunction).toBeCalledWith();
|
|
|
|
expect(roughArgsFunction).toBeCalledWith(expect.anything(), expect.any(Date));
|
|
|
|
expect(anyArgsFunction).toBeCalledTimes(1);
|
|
|
|
expect(uncalledFunction).not.toBeCalled();
|
|
```
|