Skip to content

Conversation

@AdrianDev374
Copy link

🧩 Description

Added support for testing window reload actions in WindowManagerFake.
Before this change, the fake only handled open, close, show, and hide, so we couldn’t verify when a component called Window::reload().

🚀 What’s new

  • Added a reload() method to record reload actions.
  • Added two new assertions:
  • assertReloaded() – checks if a window was reloaded (optionally by ID).
  • assertNotReloaded() – checks that no reload happened.
  • Updated tests to use the new assertions.

@gwleuverink
Copy link
Collaborator

Hey @AdrianDev374 Thank you for your contribution!

This is looking great 🙏🏻 I ran into a tiny problem, which is not limited to what's added in this PR, but also exist on the other assertion methods.

If we call refresh without any arguments it will automatically detect the current window eg Window::reload(). So no arguments are required here.

The assertion however expects it to be given input. So this fails: Window::assertReloaded()

I can fix this by making the id argument null by default. But it might be good to think about what's expected here.

If you call Window::assertReloaded() without any argument would you expect this to assert the current window was reloaded or should we assert any window was reloaded?

@AdrianDev374
Copy link
Author

Hi @gwleuverink

In my opinion, it would be nice if the ID is null, it checks if the current window has been reloaded, and if an ID is passed, it checks if that window has been reloaded.

In my application, I work with multiple windows, and I think it might be more interesting to be able to see if a specific window has been reloaded.

@AdrianDev374
Copy link
Author

Hey @gwleuverink

if ($id === null) {
      $id = $this->current()->getId();
}

Maybe adding this and making the id of the assert nullable.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants