UncleGedd commented on code in PR #331:
URL: 
https://github.com/apache/incubator-flagon-useralejs/pull/331#discussion_r1060137498


##########
test/packageLogs_spec.js:
##########
@@ -313,28 +313,15 @@ describe('packageLogs', () => {
     describe('buildPath', () => {
         it('builds a path', () => {
             new JSDOM(``)
+            let actualPath
             const document = window.document;
             const ele = document.createElement('div');
-            const evt = document.createEvent('CustomEvent');
-            evt.initEvent('testEvent', true, true);
+            const evt = new window.Event('CustomEvent', {bubbles: true, 
cancelable: true})
             document.body.appendChild(ele);
+            ele.addEventListener('CustomEvent', e => actualPath = buildPath(e))
             ele.dispatchEvent(evt);
-            expect(buildPath(evt)).to.deep.equal(['div', 'body', 'html']);
-        });
-
-        it('defaults to path if available', () => {
-            new JSDOM(``)
-            const document = window.document;
-            const ele = document.createElement('div');
-            const evt = document.createEvent('CustomEvent');
-            document.body.appendChild(ele);
-            evt.initEvent('testEvent', true, true);
-            ele.dispatchEvent(evt);
-            evt.composedPath = function() {
-                let ele = evt.target;
-                return [ele, ele.parentElement, 
ele.parentElement.parentElement];
-            };
-            expect(buildPath(evt)).to.deep.equal(['div', 'body', 'html']);
+            const expectedPath = ['div', 'body', 'html',   "#document", 
"Window"]

Review Comment:
   Noting here that the `expectedPath` now includes `"#document"` and 
`"Window"`. This is expected behavior with `composedPath`, see screenshot from 
Chrome dev tools below:
   <img width="554" alt="Screen Shot 2023-01-02 at 11 14 13 AM" 
src="https://user-images.githubusercontent.com/42304551/210262096-5436c066-57a9-481c-906f-85069f0e8fae.png";>
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@flagon.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to