livewire / volt

Volt is an elegantly crafted functional API for Livewire.
https://livewire.laravel.com/docs/volt
MIT License
327 stars 19 forks source link

Call to undefined method Livewire\Volt\VoltManager::withQueryParams() #50

Closed robsontenorio closed 11 months ago

robsontenorio commented 11 months ago

Volt Version

1.3

Laravel Version

10.23

PHP Version

8.2

Database Driver & Version

No response

Description

Call to undefined method Livewire\Volt\VoltManager::withQueryParams()

Steps To Reproduce

Test

`Volt::withQueryParams(['search' => 'hair'])->test('users')->....`
driesvints commented 11 months ago

This method doesn't seems to exist both in the codebase and the documentation. Unsure why you're calling it?

robsontenorio commented 11 months ago

@driesvints

https://livewire.laravel.com/docs/testing#setting-url-parameters

image
driesvints commented 11 months ago

This doesn't seems possible with Volt right now. If it's possible to create a PR for this feature we can have a look.

robsontenorio commented 11 months ago

@driesvints Is there any alternative to test my Volt components when query params is needed?

inmanturbo commented 11 months ago

As an alternative, if you are using query params to set the value of a property, you can just set the property on the component to the value you need in the test. Livewire itself has tests to prove that query strings work, so there's no need to test this in every application.

robsontenorio commented 11 months ago

@inmanturbo But it won't cover test case that depends on url query params. Am I wrong?

image image
driesvints commented 11 months ago

@robsontenorio Nuno has added this in the meantime: https://github.com/livewire/volt/pull/51