Skip to content

Commit

Permalink
Merge pull request #63 from BitBagCommerce/OPSRC-577/Fix_auto_block_r…
Browse files Browse the repository at this point in the history
…ule_form

Add event trigger on type select
  • Loading branch information
liszkapawel authored Aug 25, 2022
2 parents 0fc0a54 + e246d6b commit 02f2886
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
14 changes: 14 additions & 0 deletions src/Resources/assets/admin/automaticBlacklistingConfiguration.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const addRuleBtn = document.querySelector('[data-form-collection="add"]');

const turnOnListener = () => {
addRuleBtn?.addEventListener('click', () => {
setTimeout(() => {
const configurationTypeSelects = document.querySelectorAll('[data-form-collection="update"]');
const changeEvent = new Event('change', { 'bubbles': true });

configurationTypeSelects[configurationTypeSelects.length - 1].dispatchEvent(changeEvent);
}, 100);
});
}

turnOnListener();
1 change: 1 addition & 0 deletions src/Resources/assets/admin/entry.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import './automaticBlacklistingConfiguration';
2 changes: 1 addition & 1 deletion tests/Application/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"slick-carousel": "^1.8.1"
},
"devDependencies": {
"@symfony/webpack-encore": "^0.28.0",
"@symfony/webpack-encore": "^1.8.2",
"babel-core": "^6.26.3",
"babel-plugin-external-helpers": "^6.22.0",
"babel-plugin-module-resolver": "^3.1.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ public function addRule(string $ruleName): void

$this->getDocument()->clickLink('Add rule');

$this->getDocument()->waitFor(5, function () use ($count) {
return $count + 1 === count($this->getCollectionItems('rules'));
});
$this->getSession()->wait(100);

$this->selectRuleOption('Type', $ruleName);
}
Expand Down

0 comments on commit 02f2886

Please sign in to comment.