Skip to content

Commit

Permalink
test: add clear method tests
Browse files Browse the repository at this point in the history
  • Loading branch information
UziTech committed Nov 22, 2020
1 parent 38e529c commit 983338a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions spec/element-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2247,6 +2247,12 @@ describe('XTerminalElement', () => {
expect(element.getXtermOptions()).toEqual(expected)
})

it('clear terminal', () => {
spyOn(element.terminal, 'clear')
element.clear()
expect(element.terminal.clear).toHaveBeenCalled()
})

it('applyPendingTerminalProfileOptions() terminal not visible', () => {
spyOn(element, 'refitTerminal')
element.terminalDivInitiallyVisible = false
Expand Down
8 changes: 7 additions & 1 deletion spec/model-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('XTerminalModel', () => {
pane = jasmine.createSpyObj('pane',
['destroyItem', 'getActiveItem'])
element = jasmine.createSpyObj('element',
['destroy', 'refitTerminal', 'focusOnTerminal', 'clickOnCurrentAnchor', 'getCurrentAnchorHref', 'restartPtyProcess'])
['destroy', 'refitTerminal', 'focusOnTerminal', 'clickOnCurrentAnchor', 'getCurrentAnchorHref', 'restartPtyProcess', 'clear'])
element.terminal = jasmine.createSpyObj('terminal',
['getSelection'])
element.ptyProcess = jasmine.createSpyObj('ptyProcess',
Expand Down Expand Up @@ -471,6 +471,12 @@ describe('XTerminalModel', () => {
expect(model.element.ptyProcess.write.calls.allArgs()).toEqual([[expectedText]])
})

it('clear()', () => {
model.element = element
model.clear()
expect(model.element.clear).toHaveBeenCalled()
})

it('setActive()', async function () {
const pane = atom.workspace.getCenter().getActivePane()
const uri = 'x-terminal://somesessionid/'
Expand Down

0 comments on commit 983338a

Please sign in to comment.