Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Fix archive summary text. #50

Merged
merged 1 commit into from
Jun 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/archive-editor-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ export default class ArchiveEditorView {
}

updateSummary () {
const fileCount = this.entries.filter((entry) => entry instanceof FileView)
const fileCount = this.entries.filter((entry) => entry instanceof FileView).length
const fileLabel = fileCount === 1 ? '1 file' : `${humanize.intComma(fileCount)} files`

const directoryCount = this.entries.filter((entry) => entry instanceof DirectoryView)
const directoryCount = this.entries.filter((entry) => entry instanceof DirectoryView).length
const directoryLabel = directoryCount === 1 ? '1 folder' : `${humanize.intComma(directoryCount)} folders`

this.refs.summary.style.display = ''
Expand Down
15 changes: 15 additions & 0 deletions spec/archive-editor-view-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,21 @@ describe "Archive viewer", ->
waitsFor -> archiveEditor.element.querySelectorAll('.entry').length > 0
runs -> expect(archiveEditor.element.querySelector('.selected').textContent).toBe 'f1.txt'

describe "archive summary", ->
beforeEach ->
waitsForPromise ->
atom.workspace.open('multiple-entries.zip')

runs ->
archiveEditor = atom.workspace.getActivePaneItem()
jasmine.attachToDOM(atom.views.getView(atom.workspace))

it "shows correct archive summary", ->
waitsFor -> archiveEditor.element.querySelectorAll('.entry').length > 0

runs ->
expect(archiveEditor.element.querySelector('.inset-panel .panel-heading').textContent).toBe '704 bytes with 4 files and 1 folder'

describe "when core:move-up/core:move-down is triggered", ->
it "selects the next/previous file", ->
waitsFor ->
Expand Down
Binary file added spec/fixtures/multiple-entries.zip
Binary file not shown.