Cannot simulate shift click in Jasmine


#1

Hey all

I’m having trouble with my specs which worked fine in 1.14.4.

The code is…

          fileViews = openTreeView(workspaceElement)
          fileView1 = fileViews[0]
          fileView2 = fileViews[1]

          fileView1.click()
          $(fileView2).trigger($.Event('click', {shiftKey: true} ))

          console.log workspaceElement.querySelector('.tree-view')

          treeViewMultiSelectElement = workspaceElement.querySelector('.tree-view > .multi-select')

With openTreeView:

openTreeView = (workspaceElement) ->
  atom.commands.dispatch(workspaceElement, 'tree-view:show')
  treeView = $(atom.workspace.getLeftDock().getActivePaneItem())[0]
  treeViewElement = workspaceElement.querySelector('.tree-view')

  dirView = $(treeView.roots[0].entries).find('.directory:contains(test-dir)')
  dirView[0].expand()

  files = treeView.element.querySelectorAll('.file')

  fileView1 = files[0]
  fileView2 = files[1]

  return [fileView1, fileView2, treeViewElement]

What should be happening is first file is left clicked then the next is shift left clicked triggering .multi-select and thus adding command atom-meld:diff-from-tree-selected and context menu Diff Selected Files

Problem is only the 2nd file is selected. I’ve also tried vanilla MouseEvent to no avail.

I hope someone can help!

Thanks