Commit 5a395e36 authored by NickWilde's avatar NickWilde

Cleanup/standards/Switch usage of JavascriptTestBase to WebDriverTestBase

parent 4432e1f8
<?php
/**
* @file Contains post update functionality for the color field module.
* @file
* Contains post update functionality for the color field module.
*/
use Drupal\Core\Entity\Entity\EntityFormDisplay;
......
......@@ -53,12 +53,12 @@ class ColorFieldWidgetBox extends ColorFieldWidgetBase {
/**
* Use element validator to make sure that hex values are in correct format.
*
* @param $element
* @param array $element
* The Default colors element.
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The current state of the form.
*/
public function settingsColorValidate($element, FormStateInterface $form_state) {
public function settingsColorValidate(array $element, FormStateInterface $form_state) {
$default_colors = $form_state->getValue($element['#parents']);
$colors = '';
if (!empty($default_colors)) {
......@@ -101,7 +101,7 @@ class ColorFieldWidgetBox extends ColorFieldWidgetBase {
*/
public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
$element = parent::formElement($items, $delta, $element, $form, $form_state);
// Ensure the default value is the expected format whatever the storage format is.
// Ensure the default value is the required format.
if ($element['color']['#default_value']) {
$element['color']['#default_value'] = strtoupper($element['color']['#default_value']);
if (strlen($element['color']['#default_value']) === 6) {
......
......@@ -4,14 +4,14 @@ namespace Drupal\Tests\color_field\FunctionalJavascript;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
/**
* Tests for form grouping elements.
*
* @group form
*/
class ColorFieldWidgetJavascriptTests extends JavascriptTestBase {
class ColorFieldWidgetJavascriptTests extends WebDriverTestBase {
/**
* Modules to enable.
......@@ -129,7 +129,6 @@ class ColorFieldWidgetJavascriptTests extends JavascriptTestBase {
$box = $boxes[0];
$this->assertEquals('#007749', $box->getAttribute('color'));
// Only one of the fields has a default, so it is the only one that should
// have a box that is selected. This also confirms that even if the storage
// setting isn't uppercase hash prefixed hex that it still correctly selects
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment