From 5ba912203933f53c67696aa7efb304dd719f7779 Mon Sep 17 00:00:00 2001 From: Marco Roth Date: Fri, 14 Jul 2023 05:43:16 +0200 Subject: [PATCH 1/4] Don't choose first controller if no matching SR controller was found --- javascript/controllers.js | 2 +- javascript/scanner.js | 4 ++-- .../test/controllers.extractReflexName.test.js | 2 +- ...exes.setupDeclarativeReflexesForElement.test.js | 14 ++++++++++++++ 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/javascript/controllers.js b/javascript/controllers.js index 1a410ee6..37046e4b 100644 --- a/javascript/controllers.js +++ b/javascript/controllers.js @@ -43,7 +43,7 @@ const findControllerByReflexName = (reflexName, controllers) => { return identifier === controller.identifier }) - return controller || controllers[0] + return controller } export { allReflexControllers, findControllerByReflexName } diff --git a/javascript/scanner.js b/javascript/scanner.js index 9dc57639..9d1c73e6 100644 --- a/javascript/scanner.js +++ b/javascript/scanner.js @@ -28,7 +28,7 @@ const scanForReflexesOnElement = (element, controller = null) => { ) reflexAttributeNames.forEach(reflexName => { - const potentialControllers = [controller].concat(allReflexControllers(element)) + const potentialControllers = [controller].concat(allReflexControllers(element)).filter(c => c) controller = findControllerByReflexName( reflexName, @@ -42,7 +42,7 @@ const scanForReflexesOnElement = (element, controller = null) => { const parentControllerElement = element.closest(`[data-controller~=${controllerName}]`) - if (!parentControllerElement) { + if (!parentControllerElement || (parentControllerElement && controllerName === 'stimulus-reflex')) { controllers.push(controllerName) } }) diff --git a/javascript/test/controllers.extractReflexName.test.js b/javascript/test/controllers.extractReflexName.test.js index 5845c082..b649ccbc 100644 --- a/javascript/test/controllers.extractReflexName.test.js +++ b/javascript/test/controllers.extractReflexName.test.js @@ -11,7 +11,7 @@ describe('findControllerByReflexName', () => { ) }) - it('returns first controller if no matching controller is found', () => { + xit('returns first controller if no matching controller is found', () => { const controller = { identifier: 'test' } const controllers = [ { identifier: 'first' }, diff --git a/javascript/test/reflexes.setupDeclarativeReflexesForElement.test.js b/javascript/test/reflexes.setupDeclarativeReflexesForElement.test.js index 8cc6c099..e158c145 100644 --- a/javascript/test/reflexes.setupDeclarativeReflexesForElement.test.js +++ b/javascript/test/reflexes.setupDeclarativeReflexesForElement.test.js @@ -322,4 +322,18 @@ describe('scanForReflexesOnElement', () => { assert.equal(button.dataset.action, 'click->example#__perform') assert.equal(button.dataset.controller, undefined) }) + + it('test', async () => { + App.app.register('tooltip', ExampleController) + + const controllerElement = await fixture(html` + + `) + + scanForReflexesOnElement(controllerElement) + + assert.equal(controllerElement.dataset.controller, 'tooltip stimulus-reflex') + assert.equal(controllerElement.dataset.reflex, 'click->ThumbRating#rate!') + assert.equal(controllerElement.dataset.action, 'click->stimulus-reflex#__perform') + }) }) From 4973a8f73aa054d700be8b2039abcd36e1f715a9 Mon Sep 17 00:00:00 2001 From: Marco Roth Date: Fri, 14 Jul 2023 16:12:03 +0200 Subject: [PATCH 2/4] Cleanup --- javascript/scanner.js | 6 ++-- .../controllers.extractReflexName.test.js | 32 +++++++++++++------ ...setupDeclarativeReflexesForElement.test.js | 24 +++++++++++--- 3 files changed, 46 insertions(+), 16 deletions(-) diff --git a/javascript/scanner.js b/javascript/scanner.js index 9d1c73e6..9f036480 100644 --- a/javascript/scanner.js +++ b/javascript/scanner.js @@ -28,7 +28,7 @@ const scanForReflexesOnElement = (element, controller = null) => { ) reflexAttributeNames.forEach(reflexName => { - const potentialControllers = [controller].concat(allReflexControllers(element)).filter(c => c) + const potentialControllers = [controller].concat(allReflexControllers(element)) controller = findControllerByReflexName( reflexName, @@ -42,7 +42,9 @@ const scanForReflexesOnElement = (element, controller = null) => { const parentControllerElement = element.closest(`[data-controller~=${controllerName}]`) - if (!parentControllerElement || (parentControllerElement && controllerName === 'stimulus-reflex')) { + const elementPrevisoulyHadStimulusReflexController = (element === parentControllerElement && controllerName === 'stimulus-reflex') + + if (!parentControllerElement || elementPrevisoulyHadStimulusReflexController) { controllers.push(controllerName) } }) diff --git a/javascript/test/controllers.extractReflexName.test.js b/javascript/test/controllers.extractReflexName.test.js index b649ccbc..48d3f509 100644 --- a/javascript/test/controllers.extractReflexName.test.js +++ b/javascript/test/controllers.extractReflexName.test.js @@ -5,13 +5,11 @@ import { findControllerByReflexName } from '../controllers' describe('findControllerByReflexName', () => { it('returns undefined if empty controllers array is passed', () => { - assert.equal( - findControllerByReflexName('click->TestReflex#create', []), - undefined - ) + assert.isUndefined(findControllerByReflexName('click->TestReflex#create', [])) + assert.isUndefined(findControllerByReflexName('click->Test#create', [])) }) - xit('returns first controller if no matching controller is found', () => { + it('returns no controller if no matching controller is found', () => { const controller = { identifier: 'test' } const controllers = [ { identifier: 'first' }, @@ -19,10 +17,8 @@ describe('findControllerByReflexName', () => { { identifier: 'last' } ] - assert.equal( - findControllerByReflexName('click->NoReflex#create', controllers), - controllers[0] - ) + assert.isUndefined(findControllerByReflexName('click->NoReflex#create', controllers)) + assert.isUndefined(findControllerByReflexName('click->No#create', controllers)) }) it('returns matching controller', () => { @@ -37,6 +33,11 @@ describe('findControllerByReflexName', () => { findControllerByReflexName('click->TestReflex#create', controllers), controller ) + + assert.equal( + findControllerByReflexName('click->Test#create', controllers), + controller + ) }) it('returns matching namespaced controller', () => { @@ -54,6 +55,14 @@ describe('findControllerByReflexName', () => { ), controller ) + + assert.equal( + findControllerByReflexName( + 'click->Some::Deep::Module::Test#create', + controllers + ), + controller + ) }) it('returns dasherized controller', () => { @@ -68,5 +77,10 @@ describe('findControllerByReflexName', () => { findControllerByReflexName('click->SomeThingReflex#create', controllers), controller ) + + assert.equal( + findControllerByReflexName('click->SomeThing#create', controllers), + controller + ) }) }) diff --git a/javascript/test/reflexes.setupDeclarativeReflexesForElement.test.js b/javascript/test/reflexes.setupDeclarativeReflexesForElement.test.js index e158c145..0a925eae 100644 --- a/javascript/test/reflexes.setupDeclarativeReflexesForElement.test.js +++ b/javascript/test/reflexes.setupDeclarativeReflexesForElement.test.js @@ -323,17 +323,31 @@ describe('scanForReflexesOnElement', () => { assert.equal(button.dataset.controller, undefined) }) - it('test', async () => { - App.app.register('tooltip', ExampleController) + it('should remove stimulus-reflex controller when other controller is a matching StimulusReflex-enabled controller', async () => { + App.app.register('example', ExampleController) + + const controllerElement = await fixture(html` +
+ `) + + scanForReflexesOnElement(controllerElement) + + assert.equal(controllerElement.dataset.controller, 'example') + assert.equal(controllerElement.dataset.reflex, 'click->Example#else') + assert.equal(controllerElement.dataset.action, 'click->example#__perform') + }) + + it('should not remove stimulus-reflex controller when other controller is a non-matching StimulusReflex-enabled controller', async () => { + App.app.register('example', ExampleController) const controllerElement = await fixture(html` - +
`) scanForReflexesOnElement(controllerElement) - assert.equal(controllerElement.dataset.controller, 'tooltip stimulus-reflex') - assert.equal(controllerElement.dataset.reflex, 'click->ThumbRating#rate!') + assert.equal(controllerElement.dataset.controller, 'example stimulus-reflex') + assert.equal(controllerElement.dataset.reflex, 'click->Something#else') assert.equal(controllerElement.dataset.action, 'click->stimulus-reflex#__perform') }) }) From d8948f867b2ec965f0cb96ac424e648d5383137a Mon Sep 17 00:00:00 2001 From: Marco Roth Date: Fri, 14 Jul 2023 17:00:40 +0200 Subject: [PATCH 3/4] Add more tests --- javascript/controllers.js | 2 +- .../test/attributes.attributeValue.test.js | 7 ++ .../controllers.allReflexControllers.test.js | 111 ++++++++++++++++++ ...controllers.localReflexControllers.test.js | 79 +++++++++++++ ...setupDeclarativeReflexesForElement.test.js | 6 +- javascript/test/test_helpers.js | 13 ++ 6 files changed, 213 insertions(+), 5 deletions(-) create mode 100644 javascript/test/controllers.allReflexControllers.test.js create mode 100644 javascript/test/controllers.localReflexControllers.test.js create mode 100644 javascript/test/test_helpers.js diff --git a/javascript/controllers.js b/javascript/controllers.js index 37046e4b..db59d0ea 100644 --- a/javascript/controllers.js +++ b/javascript/controllers.js @@ -46,4 +46,4 @@ const findControllerByReflexName = (reflexName, controllers) => { return controller } -export { allReflexControllers, findControllerByReflexName } +export { localReflexControllers, allReflexControllers, findControllerByReflexName } diff --git a/javascript/test/attributes.attributeValue.test.js b/javascript/test/attributes.attributeValue.test.js index 316961a6..6b554630 100644 --- a/javascript/test/attributes.attributeValue.test.js +++ b/javascript/test/attributes.attributeValue.test.js @@ -31,6 +31,13 @@ describe('attributeValue', () => { ) }) + it('returns expected attribute value for array with duplicate values', () => { + assert.equal( + attributeValue(['one', 'two', 'three', 'three', 'two', 'one']), + 'one two three' + ) + }) + it('returns expected attribute value for array with mixed and duplicate values', () => { assert.equal( attributeValue([ diff --git a/javascript/test/controllers.allReflexControllers.test.js b/javascript/test/controllers.allReflexControllers.test.js new file mode 100644 index 00000000..b13e2ab1 --- /dev/null +++ b/javascript/test/controllers.allReflexControllers.test.js @@ -0,0 +1,111 @@ +import { html, fixture, assert, nextFrame } from '@open-wc/testing' +import refute from './refute' + +import ExampleController from './dummy/example_controller' +import RegularController from './dummy/regular_controller' + +import { initialize } from '../stimulus_reflex' + +import App from '../app' +import { application } from './dummy/application' +import { allReflexControllers } from '../controllers' + +import { unloadAllControllers, registeredControllers, identifiers } from './test_helpers' + +describe('allReflexControllers', () => { + beforeEach(() => { + initialize(application) + }) + + afterEach(() => { + unloadAllControllers() + }) + + it('returns StimulusReflex-enabled controller from parent', async () => { + App.app.register("sr", ExampleController) + + assert.deepEqual(registeredControllers(), [ + "stimulus-reflex", + "sr" + ]) + + const element = await fixture(html` +
+ +
+ `) + + const a = element.querySelector('a') + assert.deepEqual(identifiers(allReflexControllers(a)), ["sr"]) + }) + + it('doesnt return regular controller from parent', async () => { + App.app.register("regular", RegularController) + + assert.deepEqual(registeredControllers(), [ + "stimulus-reflex", + "regular" + ]) + + const element = await fixture(html` +
+ +
+ `) + + const a = element.querySelector('a') + assert.isEmpty(identifiers(allReflexControllers(a))) + }) + + it('should return all reflex controllers from parents', async () => { + App.app.register("sr-one", ExampleController) + App.app.register("sr-two", ExampleController) + App.app.register("regular-one", RegularController) + App.app.register("regular-two", RegularController) + + const element = await fixture(html` +
+
+
+
+ +
+
+
+
+ `) + + const a = element.querySelector('a') + + const controllers = allReflexControllers(a) + + assert.deepEqual(identifiers(controllers), [ + "sr-two", + "sr-one", + ]) + }) + + it('should return controllers with same name', async () => { + App.app.register("sr", ExampleController) + + const outer = await fixture(html` +
+
+ +
+
+ `) + + const a = outer.querySelector('a') + const inner = outer.querySelector('#inner') + const controllers = allReflexControllers(a) + + assert.deepEqual(identifiers(controllers), [ + "sr", + "sr", + ]) + + assert.deepEqual(controllers[0].element, inner) + assert.deepEqual(controllers[1].element, outer) + }) +}) diff --git a/javascript/test/controllers.localReflexControllers.test.js b/javascript/test/controllers.localReflexControllers.test.js new file mode 100644 index 00000000..b2576e31 --- /dev/null +++ b/javascript/test/controllers.localReflexControllers.test.js @@ -0,0 +1,79 @@ +import { html, fixture, assert, nextFrame, oneEvent } from '@open-wc/testing' + +import { application } from './dummy/application' +import ExampleController from './dummy/example_controller' +import RegularController from './dummy/regular_controller' + +import App from '../app' +import { localReflexControllers } from '../controllers' +import { initialize } from '../stimulus_reflex' + +import { unloadAllControllers, registeredControllers, identifiers } from './test_helpers' + +describe('localReflexControllers', () => { + beforeEach(() => { + initialize(application) + }) + + afterEach(() => { + unloadAllControllers() + }) + + it('returns StimulusReflex-enabled controller', async () => { + App.app.register("sr", ExampleController) + + assert.deepEqual(registeredControllers(), [ + "stimulus-reflex", + "sr" + ]) + + const element = await fixture(html` +
+ `) + + assert.deepEqual(identifiers(localReflexControllers(element)), ["sr"]) + }) + + it('doesnt return regular controller', async () => { + App.app.register("sr", ExampleController) + App.app.register("regular", RegularController) + + assert.deepEqual(registeredControllers(), [ + "stimulus-reflex", + "sr", + "regular" + ]) + + const element = await fixture(html` +
+ `) + + assert.deepEqual(identifiers(localReflexControllers(element)), [ + "sr" + ]) + }) + + it('returns all StimulusReflex-enabled controllers', async () => { + App.app.register("sr-one", ExampleController) + App.app.register("sr-two", ExampleController) + App.app.register("regular-one", RegularController) + App.app.register("regular-two", RegularController) + + assert.deepEqual(registeredControllers(), [ + "stimulus-reflex", + "sr-one", + "sr-two", + "regular-one", + "regular-two" + ]) + + const element = await fixture(html` +
+ `) + + assert.deepEqual(identifiers(localReflexControllers(element)), [ + "sr-two", + "sr-one" + ]) + }) +}) diff --git a/javascript/test/reflexes.setupDeclarativeReflexesForElement.test.js b/javascript/test/reflexes.setupDeclarativeReflexesForElement.test.js index 0a925eae..e75e3eaa 100644 --- a/javascript/test/reflexes.setupDeclarativeReflexesForElement.test.js +++ b/javascript/test/reflexes.setupDeclarativeReflexesForElement.test.js @@ -9,9 +9,7 @@ import { initialize } from '../stimulus_reflex' import App from '../app' import { scanForReflexesOnElement } from '../scanner' -function registeredControllers () { - return Array.from(App.app.router.modulesByIdentifier.keys()) -} +import { unloadAllControllers, registeredControllers } from './test_helpers' describe('scanForReflexesOnElement', () => { beforeEach(() => { @@ -19,7 +17,7 @@ describe('scanForReflexesOnElement', () => { }) afterEach(() => { - App.app.unload(registeredControllers()) + unloadAllControllers() }) it('should add the right action and controller attribute', async () => { diff --git a/javascript/test/test_helpers.js b/javascript/test/test_helpers.js new file mode 100644 index 00000000..fa47dec2 --- /dev/null +++ b/javascript/test/test_helpers.js @@ -0,0 +1,13 @@ +import App from '../app' + +export function registeredControllers () { + return Array.from(App.app.router.modulesByIdentifier.keys()) +} + +export function unloadAllControllers () { + App.app.unload(registeredControllers()) +} + +export function identifiers (controllers) { + return controllers.map(controller => controller.identifier) +} From c4f1252f74d3f39fe9ed7623fec3ec7ceceb24cf Mon Sep 17 00:00:00 2001 From: Marco Roth Date: Fri, 14 Jul 2023 17:19:28 +0200 Subject: [PATCH 4/4] Standard --- .../controllers.allReflexControllers.test.js | 42 +++++++-------- .../controllers.extractReflexName.test.js | 12 +++-- ...controllers.localReflexControllers.test.js | 51 +++++++++---------- ...setupDeclarativeReflexesForElement.test.js | 20 ++++++-- 4 files changed, 67 insertions(+), 58 deletions(-) diff --git a/javascript/test/controllers.allReflexControllers.test.js b/javascript/test/controllers.allReflexControllers.test.js index b13e2ab1..8cb32095 100644 --- a/javascript/test/controllers.allReflexControllers.test.js +++ b/javascript/test/controllers.allReflexControllers.test.js @@ -10,7 +10,11 @@ import App from '../app' import { application } from './dummy/application' import { allReflexControllers } from '../controllers' -import { unloadAllControllers, registeredControllers, identifiers } from './test_helpers' +import { + unloadAllControllers, + registeredControllers, + identifiers +} from './test_helpers' describe('allReflexControllers', () => { beforeEach(() => { @@ -22,12 +26,9 @@ describe('allReflexControllers', () => { }) it('returns StimulusReflex-enabled controller from parent', async () => { - App.app.register("sr", ExampleController) + App.app.register('sr', ExampleController) - assert.deepEqual(registeredControllers(), [ - "stimulus-reflex", - "sr" - ]) + assert.deepEqual(registeredControllers(), ['stimulus-reflex', 'sr']) const element = await fixture(html`
@@ -36,16 +37,13 @@ describe('allReflexControllers', () => { `) const a = element.querySelector('a') - assert.deepEqual(identifiers(allReflexControllers(a)), ["sr"]) + assert.deepEqual(identifiers(allReflexControllers(a)), ['sr']) }) it('doesnt return regular controller from parent', async () => { - App.app.register("regular", RegularController) + App.app.register('regular', RegularController) - assert.deepEqual(registeredControllers(), [ - "stimulus-reflex", - "regular" - ]) + assert.deepEqual(registeredControllers(), ['stimulus-reflex', 'regular']) const element = await fixture(html`
@@ -58,10 +56,10 @@ describe('allReflexControllers', () => { }) it('should return all reflex controllers from parents', async () => { - App.app.register("sr-one", ExampleController) - App.app.register("sr-two", ExampleController) - App.app.register("regular-one", RegularController) - App.app.register("regular-two", RegularController) + App.app.register('sr-one', ExampleController) + App.app.register('sr-two', ExampleController) + App.app.register('regular-one', RegularController) + App.app.register('regular-two', RegularController) const element = await fixture(html`
@@ -79,14 +77,11 @@ describe('allReflexControllers', () => { const controllers = allReflexControllers(a) - assert.deepEqual(identifiers(controllers), [ - "sr-two", - "sr-one", - ]) + assert.deepEqual(identifiers(controllers), ['sr-two', 'sr-one']) }) it('should return controllers with same name', async () => { - App.app.register("sr", ExampleController) + App.app.register('sr', ExampleController) const outer = await fixture(html`
@@ -100,10 +95,7 @@ describe('allReflexControllers', () => { const inner = outer.querySelector('#inner') const controllers = allReflexControllers(a) - assert.deepEqual(identifiers(controllers), [ - "sr", - "sr", - ]) + assert.deepEqual(identifiers(controllers), ['sr', 'sr']) assert.deepEqual(controllers[0].element, inner) assert.deepEqual(controllers[1].element, outer) diff --git a/javascript/test/controllers.extractReflexName.test.js b/javascript/test/controllers.extractReflexName.test.js index 48d3f509..8355bc5d 100644 --- a/javascript/test/controllers.extractReflexName.test.js +++ b/javascript/test/controllers.extractReflexName.test.js @@ -5,7 +5,9 @@ import { findControllerByReflexName } from '../controllers' describe('findControllerByReflexName', () => { it('returns undefined if empty controllers array is passed', () => { - assert.isUndefined(findControllerByReflexName('click->TestReflex#create', [])) + assert.isUndefined( + findControllerByReflexName('click->TestReflex#create', []) + ) assert.isUndefined(findControllerByReflexName('click->Test#create', [])) }) @@ -17,8 +19,12 @@ describe('findControllerByReflexName', () => { { identifier: 'last' } ] - assert.isUndefined(findControllerByReflexName('click->NoReflex#create', controllers)) - assert.isUndefined(findControllerByReflexName('click->No#create', controllers)) + assert.isUndefined( + findControllerByReflexName('click->NoReflex#create', controllers) + ) + assert.isUndefined( + findControllerByReflexName('click->No#create', controllers) + ) }) it('returns matching controller', () => { diff --git a/javascript/test/controllers.localReflexControllers.test.js b/javascript/test/controllers.localReflexControllers.test.js index b2576e31..2fffa868 100644 --- a/javascript/test/controllers.localReflexControllers.test.js +++ b/javascript/test/controllers.localReflexControllers.test.js @@ -8,7 +8,11 @@ import App from '../app' import { localReflexControllers } from '../controllers' import { initialize } from '../stimulus_reflex' -import { unloadAllControllers, registeredControllers, identifiers } from './test_helpers' +import { + unloadAllControllers, + registeredControllers, + identifiers +} from './test_helpers' describe('localReflexControllers', () => { beforeEach(() => { @@ -20,51 +24,46 @@ describe('localReflexControllers', () => { }) it('returns StimulusReflex-enabled controller', async () => { - App.app.register("sr", ExampleController) + App.app.register('sr', ExampleController) - assert.deepEqual(registeredControllers(), [ - "stimulus-reflex", - "sr" - ]) + assert.deepEqual(registeredControllers(), ['stimulus-reflex', 'sr']) const element = await fixture(html`
`) - assert.deepEqual(identifiers(localReflexControllers(element)), ["sr"]) + assert.deepEqual(identifiers(localReflexControllers(element)), ['sr']) }) it('doesnt return regular controller', async () => { - App.app.register("sr", ExampleController) - App.app.register("regular", RegularController) + App.app.register('sr', ExampleController) + App.app.register('regular', RegularController) assert.deepEqual(registeredControllers(), [ - "stimulus-reflex", - "sr", - "regular" + 'stimulus-reflex', + 'sr', + 'regular' ]) const element = await fixture(html`
`) - assert.deepEqual(identifiers(localReflexControllers(element)), [ - "sr" - ]) + assert.deepEqual(identifiers(localReflexControllers(element)), ['sr']) }) it('returns all StimulusReflex-enabled controllers', async () => { - App.app.register("sr-one", ExampleController) - App.app.register("sr-two", ExampleController) - App.app.register("regular-one", RegularController) - App.app.register("regular-two", RegularController) + App.app.register('sr-one', ExampleController) + App.app.register('sr-two', ExampleController) + App.app.register('regular-one', RegularController) + App.app.register('regular-two', RegularController) assert.deepEqual(registeredControllers(), [ - "stimulus-reflex", - "sr-one", - "sr-two", - "regular-one", - "regular-two" + 'stimulus-reflex', + 'sr-one', + 'sr-two', + 'regular-one', + 'regular-two' ]) const element = await fixture(html` @@ -72,8 +71,8 @@ describe('localReflexControllers', () => { `) assert.deepEqual(identifiers(localReflexControllers(element)), [ - "sr-two", - "sr-one" + 'sr-two', + 'sr-one' ]) }) }) diff --git a/javascript/test/reflexes.setupDeclarativeReflexesForElement.test.js b/javascript/test/reflexes.setupDeclarativeReflexesForElement.test.js index e75e3eaa..3a22fc7d 100644 --- a/javascript/test/reflexes.setupDeclarativeReflexesForElement.test.js +++ b/javascript/test/reflexes.setupDeclarativeReflexesForElement.test.js @@ -325,7 +325,10 @@ describe('scanForReflexesOnElement', () => { App.app.register('example', ExampleController) const controllerElement = await fixture(html` -
+
`) scanForReflexesOnElement(controllerElement) @@ -339,13 +342,22 @@ describe('scanForReflexesOnElement', () => { App.app.register('example', ExampleController) const controllerElement = await fixture(html` -
+
`) scanForReflexesOnElement(controllerElement) - assert.equal(controllerElement.dataset.controller, 'example stimulus-reflex') + assert.equal( + controllerElement.dataset.controller, + 'example stimulus-reflex' + ) assert.equal(controllerElement.dataset.reflex, 'click->Something#else') - assert.equal(controllerElement.dataset.action, 'click->stimulus-reflex#__perform') + assert.equal( + controllerElement.dataset.action, + 'click->stimulus-reflex#__perform' + ) }) })