mirror of
https://github.com/atom/atom.git
synced 2026-01-24 22:38:20 -05:00
✅ Add tests for images and archives
This commit is contained in:
@@ -7,7 +7,7 @@ path = require 'path'
|
||||
temp = require 'temp'
|
||||
|
||||
describe "PaneView", ->
|
||||
[container, containerModel, view1, view2, editor1, editor2, pane, paneModel, deserializerDisposable] = []
|
||||
[container, containerModel, view1, view2, editor1, editor2, image, archive, pane, paneModel, deserializerDisposable] = []
|
||||
|
||||
class TestView extends View
|
||||
@deserialize: ({id, text}) -> new TestView({id, text})
|
||||
@@ -37,10 +37,16 @@ describe "PaneView", ->
|
||||
waitsForPromise ->
|
||||
atom.workspace.open('sample.txt').then (o) -> editor2 = o
|
||||
|
||||
waitsForPromise ->
|
||||
atom.workspace.open('sample.png').then (o) -> image = o
|
||||
|
||||
waitsForPromise ->
|
||||
atom.workspace.open('sample.zip').then (o) -> archive = o
|
||||
|
||||
runs ->
|
||||
pane = container.getRoot()
|
||||
paneModel = pane.getModel()
|
||||
paneModel.addItems([view1, editor1, view2, editor2])
|
||||
paneModel.addItems([view1, editor1, view2, editor2, image, archive])
|
||||
|
||||
afterEach ->
|
||||
deserializerDisposable.dispose()
|
||||
@@ -118,10 +124,14 @@ describe "PaneView", ->
|
||||
paneModel.activateItem(view2)
|
||||
expect(pane.itemViews.find('#view-2').length).toBe 1
|
||||
|
||||
describe "when the active item implements ::getPath", ->
|
||||
describe "when the new activeItem implements ::getPath", ->
|
||||
fit "adds .has-file-path to the active item element", ->
|
||||
paneModel.activateItem(editor1)
|
||||
expect(pane.itemViews.find('atom-text-editor')).toHaveClass('has-file-path')
|
||||
paneModel.activateItem(image)
|
||||
expect(pane.itemViews.find('.image-view')).toHaveClass('has-file-path')
|
||||
paneModel.activateItem(archive)
|
||||
expect(pane.itemViews.find('.archive-editor')).toHaveClass('has-file-path')
|
||||
|
||||
describe "when an item is destroyed", ->
|
||||
it "triggers the 'pane:item-removed' event with the item and its former index", ->
|
||||
|
||||
Reference in New Issue
Block a user