diff --git a/src/behaviors/CssRuleBehavior.php b/src/behaviors/CssRuleBehavior.php index 5199ad0..e0ab182 100644 --- a/src/behaviors/CssRuleBehavior.php +++ b/src/behaviors/CssRuleBehavior.php @@ -51,6 +51,13 @@ public function __toString() return $this->owner->css['__cssRules']->addRule($value, $key, $selector); } + public function clearCssRules() + { + unset($this->owner->css['__cssRules']); + + return $this; + } + public function getCssRules() { return $this->owner->css['__cssRules'] ?? null; diff --git a/tests/Pest.php b/tests/Pest.php index 78e2f39..c42691a 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -20,6 +20,10 @@ Craft::setAlias('@templates', __DIR__.'/templates'); })->in('./'); +uses()->afterEach(function () { + Craft::$app->getView()->clearCssRules(); +})->in('./'); + /* |-------------------------------------------------------------------------- | Expectations