File tree Expand file tree Collapse file tree 5 files changed +9
-1
lines changed
Expand file tree Collapse file tree 5 files changed +9
-1
lines changed Original file line number Diff line number Diff line change 77## 11.0.1 October 08, 2024
88
99- Enh #275 : Make ` psr/event-dispatcher ` dependency optional (@vjik )
10+ - Bug #279 : Fix clearing theme in ` View::withClearedState() ` and ` WebView::withClearedState() ` (@vjik )
1011
1112## 11.0.0 October 02, 2024
1213
Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ public function withClearedState(): static
5454 $ new = clone $ this ;
5555 $ new ->state = new ViewState ();
5656 $ new ->localeState = new LocaleState ();
57+ $ new ->themeState = new ThemeState ();
5758 return $ new ;
5859 }
5960
Original file line number Diff line number Diff line change @@ -108,6 +108,7 @@ public function withClearedState(): static
108108 $ new = clone $ this ;
109109 $ new ->state = new WebViewState ();
110110 $ new ->localeState = new LocaleState ();
111+ $ new ->themeState = new ThemeState ();
111112 return $ new ;
112113 }
113114
Original file line number Diff line number Diff line change @@ -538,15 +538,17 @@ public function testClear(): void
538538
539539 public function testWithClearedState (): void
540540 {
541- $ view = TestHelper:: createView ();
541+ $ view = new View ();
542542 $ view ->setBlock ('name ' , 'Mike ' );
543543 $ view ->setParameter ('age ' , 42 );
544+ $ view ->setTheme (new Theme ());
544545
545546 $ newView = $ view ->withClearedState ();
546547
547548 $ this ->assertNull ($ newView ->getViewFile ());
548549 $ this ->assertFalse ($ newView ->hasBlock ('name ' ));
549550 $ this ->assertFalse ($ newView ->hasParameter ('age ' ));
551+ $ this ->assertNull ($ newView ->getTheme ());
550552 }
551553
552554 public function testCommonStateForClonedViews (): void
Original file line number Diff line number Diff line change 2525use Yiisoft \View \Event \WebView \PageEnd ;
2626use Yiisoft \View \Tests \TestSupport \TestHelper ;
2727use Yiisoft \View \Tests \TestSupport \TestTrait ;
28+ use Yiisoft \View \Theme ;
2829use Yiisoft \View \WebView ;
2930
3031final class WebViewTest extends TestCase
@@ -966,13 +967,15 @@ public function testWithClearedState(): void
966967 $ webView ->registerCssFile ('./main.css ' );
967968 $ webView ->registerJs ('alert(42); ' );
968969 $ webView ->registerJsFile ('./main.js ' );
970+ $ webView ->setTheme (new Theme ());
969971
970972 $ newWebView = $ webView ->withClearedState ();
971973
972974 $ this ->assertNull ($ newWebView ->getViewFile ());
973975 $ this ->assertFalse ($ newWebView ->hasBlock ('name ' ));
974976 $ this ->assertFalse ($ newWebView ->hasParameter ('age ' ));
975977 $ this ->assertSame ('' , $ newWebView ->getTitle ());
978+ $ this ->assertNull ($ newWebView ->getTheme ());
976979
977980 $ this ->assertSame (
978981 '[BEGINPAGE][/BEGINPAGE] ' . "\n" .
You can’t perform that action at this time.
0 commit comments