This repository has been archived by the owner on Mar 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17.4k
Adds configuration option for large file warning threshold. #12439
Merged
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b32b8b4
Adds configuration option for large file warning threshold.
remexre 5a1def0
Updates spec for configurable large file limit.
remexre 324bf64
Improves specs for configurable large file limit.
remexre 7be9ff5
:art: Improves customizable-size-warning spec styling.
remexre 05602a8
:green_heart: Fixes tests for configurable large-file-warning.
remexre 10b3cbc
:green_heart: Hopefully fixes configurable-filesize-warning limit specs.
remexre File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -432,31 +432,37 @@ describe "Workspace", -> | |
runs -> | ||
expect(editor.largeFileMode).toBe true | ||
|
||
describe "when the file is over 20MB", -> | ||
it "prompts the user to make sure they want to open a file this big", -> | ||
spyOn(fs, 'getSizeSync').andReturn 20 * 1048577 # 20MB | ||
describe "when the file is over user-defined limit", -> | ||
test = (size, shouldPrompt) -> | ||
spyOn(fs, 'getSizeSync').andReturn size * 1048577 | ||
atom.applicationDelegate.confirm.andCallFake -> selectedButtonIndex | ||
atom.applicationDelegate.confirm() | ||
selectedButtonIndex = 1 # cancel | ||
|
||
editor = null | ||
waitsForPromise -> | ||
workspace.open('sample.js').then (e) -> editor = e | ||
if shouldPrompt | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How would I do that, exactly? I'm not 100% familiar with Atom's internal structure... |
||
runs -> | ||
expect(editor).toBeUndefined() | ||
expect(atom.applicationDelegate.confirm).toHaveBeenCalled() | ||
|
||
runs -> | ||
expect(editor).toBeUndefined() | ||
expect(atom.applicationDelegate.confirm).toHaveBeenCalled() | ||
|
||
atom.applicationDelegate.confirm.reset() | ||
selectedButtonIndex = 0 # open the file | ||
atom.applicationDelegate.confirm.reset() | ||
selectedButtonIndex = 0 # open the file | ||
|
||
waitsForPromise -> | ||
workspace.open('sample.js').then (e) -> editor = e | ||
waitsForPromise -> | ||
workspace.open('sample.js').then (e) -> editor = e | ||
|
||
runs -> | ||
expect(atom.applicationDelegate.confirm).toHaveBeenCalled() | ||
expect(editor.largeFileMode).toBe true | ||
|
||
it "prompts the user to make sure they want to open a file this big", -> | ||
atom.config.set "core.warnOnLargeFileLimit", 20 | ||
test 20, true | ||
it "doesn't prompt on files below the limit", -> | ||
atom.config.set "core.warnOnLargeFileLimit", 30 | ||
test 20, false | ||
it "prompts for smaller files with a lower limit", -> | ||
atom.config.set "core.warnOnLargeFileLimit", 5 | ||
test 10, true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you space this stuff out? |
||
describe "when passed a path that matches a custom opener", -> | ||
it "returns the resource returned by the custom opener", -> | ||
fooOpener = (pathToOpen, options) -> {foo: pathToOpen, options} if pathToOpen?.match(/\.foo/) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you give this helper a more descriptive name?