From b211aecb99d5b09f7f178fa5c5e96e175a136b54 Mon Sep 17 00:00:00 2001 From: Brooke Bryan Date: Sun, 23 Aug 2020 21:55:35 +0100 Subject: [PATCH] Test replacements --- .../AbstractDataHandlerDecorator.php | 10 +++++----- src/Decorators/CheckboxDecorator.php | 2 +- src/Decorators/RadioDecorator.php | 2 +- .../DataHandlers/AbstractDataHandlerTest.php | 8 ++++---- tests/DataHandlers/BooleanHandlerTest.php | 6 +++--- tests/DataHandlers/EnumDataHandlerTest.php | 20 +++++++++---------- tests/DataHandlers/TextDataHandlerTest.php | 8 ++++---- tests/Decorators/FormCustomDecoratorTest.php | 4 ++-- 8 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/Decorators/AbstractDataHandlerDecorator.php b/src/Decorators/AbstractDataHandlerDecorator.php index 811c7c6..d256287 100644 --- a/src/Decorators/AbstractDataHandlerDecorator.php +++ b/src/Decorators/AbstractDataHandlerDecorator.php @@ -74,10 +74,10 @@ public function getLabel(): ?HtmlTag protected function _prepareForProduce(): HtmlElement { - $this->addClass('p-form-field'); + $this->addClass('p-form__field'); if($this->_handler->getErrors()) { - $this->addClass('p-form-field--error'); + $this->addClass('p-form__field--error'); } return parent::_prepareForProduce(); } @@ -168,15 +168,15 @@ protected function _formatElements(HtmlTag $input, ?HtmlTag $label, ?HtmlTag $er $return = array_fill_keys($this->getElementOrder(), null); if(array_key_exists(self::LABEL, $return) && $label) { - $return[self::LABEL] = Div::create($label)->addClass('p-form--label'); + $return[self::LABEL] = Div::create($label)->addClass('p-form__label'); } if(array_key_exists(self::ERRORS, $return) && $errors) { - $return[self::ERRORS] = Div::create($errors)->addClass('p-form--errors'); + $return[self::ERRORS] = Div::create($errors)->addClass('p-form__errors'); } if(array_key_exists(self::INPUT, $return)) { - $return[self::INPUT] = Div::create($input)->addClass('p-form--input'); + $return[self::INPUT] = Div::create($input)->addClass('p-form__input'); } // array merge, but don't replace existing diff --git a/src/Decorators/CheckboxDecorator.php b/src/Decorators/CheckboxDecorator.php index 30bcbf8..6413b98 100644 --- a/src/Decorators/CheckboxDecorator.php +++ b/src/Decorators/CheckboxDecorator.php @@ -100,7 +100,7 @@ private function _getContainer(Input $checkbox, $label) return Div::create( $checkbox, Label::create($label)->setAttribute('for', $checkbox->getId()) - )->addClass('p-form--checkbox'); + )->addClass('p-form__checkbox'); } protected function _formatElements(HtmlTag $input, ?HtmlTag $label, ?HtmlTag $errors) diff --git a/src/Decorators/RadioDecorator.php b/src/Decorators/RadioDecorator.php index 2eb59e8..574c6a0 100644 --- a/src/Decorators/RadioDecorator.php +++ b/src/Decorators/RadioDecorator.php @@ -43,7 +43,7 @@ protected function _configureInputElement(HtmlElement $input) $radio->setAttribute('checked', true); } $options[] = Div::create($radio, Label::create($label)->setAttribute('for', $radio->getid())) - ->addClass('p-form--checkbox'); + ->addClass('p-form__checkbox'); } $input->setContent($options); } diff --git a/tests/DataHandlers/AbstractDataHandlerTest.php b/tests/DataHandlers/AbstractDataHandlerTest.php index 2f32283..562a2df 100644 --- a/tests/DataHandlers/AbstractDataHandlerTest.php +++ b/tests/DataHandlers/AbstractDataHandlerTest.php @@ -64,14 +64,14 @@ public function testRender() { $fdh = new ReadOnlyDataHandler(); $this->assertEquals( - '
', + '
', $fdh->getDecorator()->render() ); $fdh = new ReadOnlyDataHandler(); $fdh->setName('myName'); $this->assertRegExp( - '/