-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OEL-3343: Changed to standalone pattern and added js tests.
- Loading branch information
Showing
10 changed files
with
108 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,3 @@ | |
@import 'listing'; | ||
@import 'columns'; | ||
@import 'patterns-preview'; | ||
@import 'copyright_overlay'; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Drupal\Tests\oe_bootstrap_theme\FunctionalJavascript; | ||
|
||
use Drupal\FunctionalJavascriptTests\WebDriverTestBase; | ||
|
||
/** | ||
* Tests the copy to clipboard functionality. | ||
*/ | ||
class CopyClipboardTest extends WebDriverTestBase { | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected $defaultTheme = 'oe_bootstrap_theme'; | ||
|
||
/** | ||
* Tests the copy to clipboard behavior in the copyright overlay. | ||
*/ | ||
public function testCopyToClipboard(): void { | ||
$this->drupalGet('/patterns/copyright_overlay'); | ||
|
||
// Open the modal by clicking the trigger. | ||
$this->assertSession()->elementExists('css', '.copyright-trigger')->click(); | ||
$this->assertSession()->waitForElementVisible('css', '.modal.show'); | ||
|
||
// Ensure the copy button exists and simulate click. | ||
$this->assertSession()->elementExists('css', '[data-copy-target=".copyright-content"]'); | ||
$this->getSession()->getPage()->clickButton('[data-copy-target=".copyright-content"]'); | ||
|
||
// Get the clipboard text via JavaScript. | ||
$expectedText = '© Lorem ipsum amet <a href="#">John Doe</a> on <a href="#">Doe Images</a>'; | ||
$actualText = $this->getClipboardText(); | ||
|
||
// Assert the copied text matches expected text. | ||
$this->assertEquals($expectedText, $actualText); | ||
} | ||
|
||
/** | ||
* Helper method to retrieve clipboard text using JavaScript. | ||
*/ | ||
protected function getClipboardText(): string { | ||
return $this->getSession()->evaluateScript('return navigator.clipboard.readText();'); | ||
} | ||
|
||
} |