Skip to content

Commit

Permalink
fixing pest not clearing rules because we're firing multiple requests…
Browse files Browse the repository at this point in the history
… per process
  • Loading branch information
markhuot committed Oct 25, 2023
1 parent 06c06c0 commit 9807101
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/behaviors/CssRuleBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions tests/Pest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
Craft::setAlias('@templates', __DIR__.'/templates');
})->in('./');

uses()->afterEach(function () {
Craft::$app->getView()->clearCssRules();
})->in('./');

/*
|--------------------------------------------------------------------------
| Expectations
Expand Down

0 comments on commit 9807101

Please sign in to comment.