Skip to content
Snippets Groups Projects
Commit fd4cd6de authored by Mark Fullmer's avatar Mark Fullmer
Browse files

Issue #3424473: Improve methodology for handling Google watermark

parent 18fecf2e
Branches
Tags 4.0.0-alpha5
1 merge request!7Issue #3424473 by mark_fullmer: Improve methodology for handling Google watermark
Pipeline #106398 passed with warnings
......@@ -4,3 +4,6 @@ input.gsc-input {
img.gcsc-branding-img-noclear {
display: none;
}
.google-cse input[type="search"] {
background: unset!important;
}
......@@ -31,7 +31,7 @@ function google_cse_form_search_block_form_alter(&$form, &$form_state, $form_id)
$form['#attached']['library'][] = 'google_cse/googlecseWatermark';
$form['#attributes']['class'][] = 'google-cse';
$language = \Drupal::languageManager()->getCurrentLanguage()->getId();
$watermark = $config['watermark'] ?? 1;
$watermark = $config['watermark'] ?? 0;
$form['#attached']['drupalSettings']['googlePSE'] = [
'language' => $language,
'displayWatermark' => $watermark,
......
......@@ -187,8 +187,8 @@ class GoogleSearch extends ConfigurableSearchPluginBase implements AccessibleInt
$form['results_searchbox_width'] = [
'#title' => $this->t('Search input width'),
'#type' => 'number',
'#min' => 1,
'#max' => 300,
'#min' => 0,
'#max' => 500,
'#size' => 6,
'#description' => $this->t('Enter the desired width, in characters, of the searchbox on the Google Search block.'),
'#default_value' => $this->configuration['results_searchbox_width'] ?? $default['results_searchbox_width'],
......
......@@ -28,7 +28,7 @@ class DisplayTest extends WebDriverTestBase {
*
* @var string
*/
protected $defaultTheme = 'stable';
protected $defaultTheme = 'stable9';
/**
* A user for tests.
......@@ -137,7 +137,7 @@ class DisplayTest extends WebDriverTestBase {
$this->drupalGet($config_form_path);
$page->fillField('edit-results-prefix', '<h3>Some results prefix text</h3><script>alert("hi");</script>');
$page->fillField('edit-results-suffix', '<h3>Some results suffix text</h3>');
$page->fillField('edit-results-searchbox-width', 10);
$page->fillField('edit-results-searchbox-width', '10');
$page->fillField('edit-custom-css', '/sites/default/files/custom.css');
$page->pressButton('Save search page');
$this->assertNotEmpty($session->waitForText('The Google Programmable Search search page has been updated.'));
......@@ -218,7 +218,7 @@ class DisplayTest extends WebDriverTestBase {
$this->drupalGet('');
$this->submitForm($terms, 'Search', 'google-cse-search-box-form');
// Module-provided block renders results on same page.
$this->assertEquals('/user/2', parse_url($this->getUrl(), PHP_URL_PATH), 'Submitted to correct URL.');
$this->assertEquals(\Drupal::request()->getBasePath() . '/user/2', parse_url($this->getUrl(), PHP_URL_PATH), 'Submitted to correct URL.');
$session->elementTextContains('css',
'div.gsc-control-cse.gsc-control-cse-en div.gsc-control-wrapper-cse div.gsc-results-wrapper-nooverlay.gsc-results-wrapper-visible div.gsc-wrapper div.gsc-resultsbox-visible div.gsc-resultsRoot.gsc-tabData.gsc-tabdActive div.gsc-results.gsc-webResult div.gsc-expansionArea div.gsc-webResult.gsc-result div.gs-webResult.gs-result div.gsc-table-result div.gsc-table-cell-snippet-close div.gs-bidi-start-align.gs-snippet',
'une chose pitoyable et burlesque'
......
......@@ -26,7 +26,7 @@ class Upgrade3to4Test extends WebDriverTestBase {
*
* @var string
*/
protected $defaultTheme = 'stable';
protected $defaultTheme = 'stable9';
/**
* {@inheritdoc}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment