Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Upgrade Electron to v1.6.x #12696

Merged
merged 407 commits into from May 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
407 commits
Select commit Hold shift + click to select a range
b6f71bc
Render overlay decorations
Mar 22, 2017
47761a4
Support class property on overlay decorations
Mar 22, 2017
f2e2475
Use spies instead of monkey patching
Mar 22, 2017
5297e7a
Add avoidOverflow: false option for overlays
Mar 22, 2017
1676617
Add static TextEditor.viewForOverlayItem method to avoid using global
Mar 22, 2017
4707803
Use the atom.views scheduler in TextEditorComponent
Mar 22, 2017
555273f
Refactor
Mar 22, 2017
251078d
Factor editor component update into high-level phases
Mar 22, 2017
9045283
Fix wrong variable name
Mar 22, 2017
fadde63
Integrate properly with Atom scheduler
Mar 22, 2017
6fefef0
Only update scrollTop/Left when they change
Mar 22, 2017
16694a2
Start on custom gutters
Mar 22, 2017
d8b22fb
Associate gutters with their elements and support showing/hiding gutters
Mar 23, 2017
1b1cffb
:arrow_up: etch to allow arbitrary objects as keys
Mar 23, 2017
d5d3cfc
Adjust left position of scroll container when gutter container resizes
Mar 23, 2017
4e834da
WIP: Render gutters before initial measurement
Mar 24, 2017
6158346
Set the height of the line number gutter explicitly
Mar 27, 2017
2880534
Store line, line number decorations in arrays and avoid slicing
Mar 28, 2017
1620204
Cache subtrees to avoid duplicating work within a single frame
Mar 29, 2017
2faec0b
Avoid using += with let variables to avoid let compound assigment deopt
Mar 29, 2017
4da579c
Unfocus test
Mar 29, 2017
b66a2ba
:arrow_up: etch
Mar 29, 2017
76b834e
Blink cursors; still needs tests
Mar 29, 2017
0cc19aa
Implement a fast path for cursor blink to minimize battery impact
Mar 29, 2017
eb22b58
Add smoke test for cursor blink
Mar 30, 2017
3b71128
Correctly assign gutter container vnode
Mar 30, 2017
7da588c
Ensure nextUpdateOnlyBlinksCursor argument is `true`, not just truthy
Mar 30, 2017
acf996f
Speed up cursor blink test
Mar 30, 2017
8652222
Add setInputEnabled and don't handle textInput if it is disabled
Mar 30, 2017
eb588d4
Test and fix the `center` option to autoscroll
Mar 30, 2017
171e4e8
Cache prefixed scope names
Mar 30, 2017
b32b760
WIP: Start on block decorations
Mar 30, 2017
5a6935a
Use `LineTopIndex` to convert from/to rows to/from pixel positions
Mar 31, 2017
f7632a9
Add fast path when no block decorations need to be measured
Apr 5, 2017
7a0a41a
Use `Array.push` instead of `array[i] =` when adding line components
Apr 5, 2017
e289283
Render block decorations between lines
Apr 5, 2017
015f196
Test scrolling down with block decorations
Apr 5, 2017
4cd9a36
Handle inserting and updating block decorations
Apr 5, 2017
316df28
Splice `LineTopIndex` when a textual change occurs
Apr 6, 2017
919c5a0
Don't use etch for lines rendering
Apr 7, 2017
7474b4b
Integrate block decorations in the custom lines rendering routine
Apr 8, 2017
b264d47
Align line number nodes with line nodes
Apr 10, 2017
bc8b548
Add TextEditorElement.prototype.invalidateBlockDecorationDimensions
Apr 10, 2017
8aae3ab
Hide cursors with non-empty selection if showCursorsOnSelection is false
Apr 10, 2017
8103bd6
Update line number gutter when invalidating a visible block decoration
Apr 11, 2017
054c133
Remeasure block decorations when editor width changes
Apr 11, 2017
b6cd473
Fix typo
Apr 11, 2017
95c8950
Re-measure and update rendered content when editor styles change
Apr 11, 2017
2c6490c
Don't update editor component if we know we are not visible
Apr 11, 2017
7aec696
Remove stray logging
Apr 11, 2017
6e6dce2
Don't re-measure if editor has become invisible
Apr 11, 2017
3fce3eb
Fix test
Apr 11, 2017
99e3c62
Clear highlight nodes when recycling line tiles
Apr 11, 2017
060a884
Include more properties in LinesTileComponent.shouldUpdate
Apr 11, 2017
b99ddfd
Remove unused var
Apr 11, 2017
8aabd02
Remove highlight caching for now
Apr 11, 2017
c83cd34
Slice lines and decorations passed to LinesTileComponent
Apr 11, 2017
8707cab
Don't count the dummy line in block decoration test
Apr 12, 2017
c8aeee9
Fix bad syntax in src/initialize-benchmark-window.js
Apr 12, 2017
6742025
Import octicon-mixins in static/text-editor.less
Apr 12, 2017
a99237b
Fix lint errors and delete dead code
Apr 12, 2017
2993f3c
Further optimize line replacement
Apr 12, 2017
1d8f4f2
Wait until the editor is focused before starting to type in smoke test
Apr 12, 2017
0210b0b
Update fake gutter container interface in gutter-spec.coffee
Apr 12, 2017
b7a421e
Stop calling `initialize` in `ViewRegistry` tests
Apr 12, 2017
e2cf60a
Don't reuse resize detectors across `TextEditorComponent` instances
Apr 12, 2017
1d01d49
Fix spec/text-editor-spec.coffee
Apr 13, 2017
f3c48c8
Register style elements change events in AtomEnvironment.initialize
Apr 13, 2017
5df17f0
Create resize detector before calling etch.updateSync for the first time
Apr 13, 2017
0a702d1
Skip obsolete tests for now, but delete them later
Apr 13, 2017
2a1ba7f
Add data-grammar to editor element
Apr 13, 2017
26b9273
Add data-encoding to editor element
Apr 13, 2017
03702a1
Add deprecated shadow root property to editor element
Apr 13, 2017
8372d08
Don't share block decoration/character measurement vnodes across inst…
Apr 13, 2017
8378717
Position dummy line element absolutely and make it invisible
Apr 13, 2017
893da22
Replace element-resize-detector with experimental ResizeObserver API
Apr 13, 2017
9bf0ea8
Test clicking more locations outside of the lines
Apr 12, 2017
9881182
Don't use position: relative on atom-text-editor
Apr 13, 2017
e602b5c
Account for scrollbars and padding in autoHeight/Width mode
Apr 13, 2017
336aa0f
Hide scrollbars in mini editors
Apr 13, 2017
87eb16f
Fix clicking fold placeholders by ignoring pointer events on cursors div
Apr 15, 2017
f83ad6b
Give cursors at the end of lines the width of an 'x' character
Apr 15, 2017
bfa410b
Add has-selection class to editors with non-empty selections
Apr 15, 2017
eb33b5c
Delete obsolete code and tests related to text editor rendering
Apr 15, 2017
c8f2fbb
Get TextEditorElement tests passing
Apr 15, 2017
174bac3
Fix lint errors
Apr 17, 2017
0441625
Set lineHeightInPixels on model for backward compatibility
Apr 17, 2017
e423b83
Replace getDefaultCharacterWidth with getBaseCharacterWidth
Apr 17, 2017
5000f9e
Convert text-editor-element-spec to JS
Apr 17, 2017
a9d0f82
Use async/await in text-editor-element-spec
Apr 17, 2017
a536c59
Add TextEditorElement.pixelPositionForScreen/BufferPosition
Apr 17, 2017
84c20d9
Add deprecated rootElement property
Apr 17, 2017
c76fc5a
Round column measurements to nearest whole pixel
Apr 17, 2017
5b07334
Assign bufferRow property to line number nodes
Apr 17, 2017
15ecbed
Don't pane focus when pane model is destroyed
Apr 17, 2017
f7c55b9
Honor the `updateSynchronously` parameter
Apr 18, 2017
6eed22a
Disconnect resize observers in overlay components on editor detach
Apr 18, 2017
55950f9
Assign placeholder text on the model only when the attribute is present
Apr 18, 2017
240a472
Disable ResizeObserver temporarily in resize callback to avoid warning
Apr 18, 2017
4d8137a
Add keys to gutterContainer and scrollContainer to avoid recycling issue
Apr 18, 2017
69a29b2
Delegate (get|set)(Height|Width) to element
Apr 18, 2017
19f5535
Add back the measureDimensions method since some packages rely on it
Apr 18, 2017
493b735
Delegate getFirst/LastVisibleScreenRow from model to component
Apr 18, 2017
4f52637
Delegate setFirstVisibleScreenRow from the model to the component
Apr 18, 2017
eb7cdf2
Delegate get/setFirstVisibleScreenColumn from the model to the component
Apr 18, 2017
5ea4096
Guard gitFirst/LastVisibleScreenRow
Apr 18, 2017
e232a86
Drop tests for set/getFirstVisibleScreenRow
Apr 18, 2017
9da6e22
Return false from isLineCommentedAtBufferRow if no line yet exists
Apr 18, 2017
129749f
Set updatedSynchronously to false in text-editor-element-spec
Apr 19, 2017
996e046
Don't update synchronously in text-editor-element-spec
Apr 19, 2017
4c8fd0c
Add tests for TextEditorElement.setScrollTop/Left
Apr 19, 2017
3d29db4
Use `position: relative` for `.line-number` elements
Apr 19, 2017
552fbf7
Honor the gutter-hidden attribute correctly
Apr 19, 2017
2a688db
Add better test coverage for the mini and placeholder-text attributes
Apr 19, 2017
9ccfd34
Remeasure gutter dimensions when a gutter changes its visibility
Apr 19, 2017
f9cb1f8
Implement `TextEditor.prototype.getRowsPerPage`
Apr 19, 2017
f2070ef
Restore editor scroll position across reloads
Apr 19, 2017
24e03ee
Fix pageUp/Down tests by using a real element
Apr 19, 2017
c38da71
Don't remove non accented character from history, improve test coverage
Apr 19, 2017
348d085
Only enable cursor blink optimization when updateSync is using scheduler
Apr 19, 2017
dfe647d
Fix lint error
Apr 19, 2017
b242f03
Don't render decorations for invalidated markers
Apr 19, 2017
2f356f8
Make process.platform easier to mock
Apr 20, 2017
1e6a1c6
Add middle mouse pasting on Linux
Apr 20, 2017
9d79b01
Fix cursor positioning around fold markers
Apr 20, 2017
e4659aa
Add data-screen-row to line nodes
Apr 20, 2017
3bca09b
Schedule update when setting scroll top row or scroll left column
Apr 20, 2017
3d6921c
Add cursor decorations
Apr 20, 2017
1cc68e4
Add TextEditorComponent.screenPositionForPixelPositionSync
Apr 20, 2017
5bbbe1d
Give line numbers the full width of the line number gutter
Apr 21, 2017
77f04c4
Consolidate editor style sheets
Apr 21, 2017
c338227
Drop floats
Apr 21, 2017
a890528
Use `Math.round` for positions that are at the end of a line
Apr 21, 2017
6a083e1
Schedule component updates directly from the model
Apr 21, 2017
8f5e421
Fix more lint errors
Apr 21, 2017
906b3b0
Update mock text editor in gutter-container-spec.coffee
Apr 21, 2017
72d6316
Fix shift-scroll on Windows and Linux
Apr 21, 2017
37b5d2e
Restore scrollbar positions correctly on reload
Apr 21, 2017
f45ff05
Add {get,set}FirstVisibleScreen{Row,Column} to TextEditorElement
Apr 21, 2017
59ae239
Provide an `editorElement` shim on TextEditor
Apr 21, 2017
e1ae374
Add a `pixelPositionForMouseEvent` method
Apr 21, 2017
efdb044
Use `cursor:text` on atom-text-editor elements
Apr 21, 2017
4bcace1
Don't remeasure scrollbars for mini editors
Apr 21, 2017
6ed7cd9
Add highlight decoration classes to region elements as well
Apr 21, 2017
207cd31
Add highlights class for package compatibility
Apr 21, 2017
0996d90
Add scrollbar classes in case any packages or themes target them
Apr 21, 2017
44539b1
Remove some redundant styling
Apr 21, 2017
b54dbb5
Add missing methods on TextEditorElement
Apr 21, 2017
a5a8044
Add intersectsVisibleRowRange on TextEditorElement
Apr 21, 2017
305fd14
Add TextEditorElement.pixelRectRangeForScreenRange for compatibility
Apr 21, 2017
1ca4c69
WIP: Start extracting gutter component
Apr 24, 2017
656cabd
Initialize all measurements to 0
Apr 24, 2017
8c7f4d9
:art:
Apr 24, 2017
7d7a6ab
Pass props to GutterContainerComponent instead of reaching up to parent
Apr 24, 2017
b23dcb7
Eliminate caching of linesVnode
Apr 24, 2017
82cdf80
Extract CursorsAndInputComponent
Apr 24, 2017
d92e0fc
Eliminate cached placeholderTextVnode
Apr 24, 2017
97125ad
Update gutter container only once per frame unless its width changes
Apr 24, 2017
1544e3b
Update cursors only once per frame (after content has been measured)
Apr 24, 2017
4b34c47
Update lines content only once per frame
Apr 24, 2017
45e9591
Cache derived dimensions during each phase of `updateSync`
Apr 24, 2017
638bb78
Fix build failures
Apr 24, 2017
7235148
Fix positioning for block decorations located at the beginning of a tile
Apr 24, 2017
46daf64
Set autoHeight: true explicitly in benchmarks
Apr 24, 2017
bd6eedc
Eliminate strictly contained divs wrapping lines and highlights
Apr 24, 2017
c7228f6
Fix error when attaching soft-wrap editor in synchronous update mode
Apr 24, 2017
c36303e
Avoid blowing away classes assigned on the editor element by packages
Apr 24, 2017
16b2fba
Fix lint errors
Apr 24, 2017
570cfde
Ignore resize events if they are delivered while the editor is hidden
Apr 25, 2017
f17baf4
Use scope ids instead of tags
May 1, 2017
ac8a908
Implement text decorations in rendering layer
May 3, 2017
c2b8541
Never create empty spans at the beginning of a row
May 4, 2017
ccc35b5
Make first-mate scope ids always larger than built-in ones
May 4, 2017
de2cfb5
:arrow_up: text-buffer
May 4, 2017
001fef4
Don't activate scrollPastEnd for autoHeight editors
May 4, 2017
fe13279
Update DOM in screenPositionForPixelPosition if needed
May 4, 2017
42bb02c
Account for vertical scrollbar width when soft-wrapping lines
May 4, 2017
abfcfb3
Set `overflow: hidden` and `contain: layout paint` on lines
May 4, 2017
c00ad62
Pass mini attribute when creating new TextEditor from TextEditorElement
May 4, 2017
1b1973d
Rename method to match old implementation
May 4, 2017
c5c4809
Avoid requesting horizontal measurement when auto-scrolling vertically
May 5, 2017
0c7030c
Only resolve update promise after final render phase
May 5, 2017
bc34344
Maintain the scroll position when changing font size
May 5, 2017
c541d39
Fix remaining test failures in core
May 5, 2017
97d2d7f
Fix remaining linting warnings
May 5, 2017
f7b79b4
Update class list even when the editor is not attached
May 5, 2017
2855e01
Don't create empty nodes when a text decoration ends next to a text tag
May 5, 2017
b9783b1
Don't 'contain: paint' line elements
May 5, 2017
15f25a7
Update width of content when approximate longest screen row changes
May 5, 2017
edf1b7f
Remove dead code
May 5, 2017
df4116d
Fix clicking past the content height
May 5, 2017
a7f658a
Move cursors within a transaction to batch marker layer update events
May 5, 2017
245f294
Call `editor.setEditorWidthInChars` only when the value changed
May 5, 2017
ecef2af
Merge pull request #13880 from atom/ns-editor-rendering
May 5, 2017
f76e850
Fix rendering artifacts when resizing with soft wraps
May 8, 2017
681a1cb
:arrow_up: text-buffer
May 8, 2017
1c8847c
:racehorse: Ensure rendered tile count is stable when scrolling
maxbrunsfeld May 8, 2017
5be2db6
Delete more dead code
May 8, 2017
7f3794b
Don't populate more screen rows than necessary
May 9, 2017
be2aaa0
Use explicit state to recycle tiles instead of modulo scheme
May 9, 2017
ca3395b
Null out component when editor is destroyed to minimize leaks
May 9, 2017
f58fd74
Dispose nodes associated with a LineComponent when replacing it
May 9, 2017
f2aba0a
:arrow_up: etch
May 9, 2017
4eecf8d
Don't change number of tiles based on block decorations
May 9, 2017
ebf2aaa
Avoid deopt when calling TokenizedLine.prototype.getTokenIterator
May 10, 2017
ab20fc3
Don't populate more screen rows than necessary
May 10, 2017
955cf98
Use bufferRowsForScreenRows to compute line numbers
May 10, 2017
42b397e
:arrow_up: line-top-index
May 10, 2017
c12882a
:arrow_up: etch
May 10, 2017
e89552e
Ignore mismatched tags between lines in TokenizedBufferIterator
May 10, 2017
58a9682
:arrow_up: text-buffer
May 10, 2017
3c87b74
Optimize isFoldable
May 10, 2017
dc6653f
Avoid creating a new timeout every time cursor blinking is paused
May 11, 2017
a0ed201
Fix blurring the editor when no hidden input is present
May 11, 2017
f3a96c9
Change editor.bufferRowsForScreenRows to include the supplied endScre…
May 11, 2017
39a5705
Re-enable a test that was previously failing
May 11, 2017
32f03c8
Delete unused code
May 11, 2017
1b27df6
:lipstick:
May 11, 2017
729ae0e
Merge branch 'master' into tj-upgrade-electron
May 11, 2017
c0af383
:arrow_up: electron
May 11, 2017
25a2d5f
:arrow_up: text-buffer
May 11, 2017
955d11b
:lipstick: Fix more lint errors
May 11, 2017
c59e972
Use buffer coordinates in isFoldedAtCursorRow
May 11, 2017
2f2f481
Don't clip screen range when autoscrolling from Cursor
May 11, 2017
8ff5d81
Prevent unnecessary clipping of buffer range in isFoldedAtBufferRow
May 11, 2017
354e0ca
:arrow_up: first-mate
May 11, 2017
80f0331
Mock Date.now in spec helper in addition to _.now
May 11, 2017
f8ecf92
Disable github package in smoke test – it takes too long to compile
May 11, 2017
d584bd6
Eliminate reliance on local storage in HistoryManager
May 11, 2017
2e2b35c
Avoid problems related to calling `startEditorWindow` in tests
May 11, 2017
8743298
Avoid polluting test with click events on the test runner
May 11, 2017
6c6d38a
Destroy environment to silence leaked editor warning
May 12, 2017
b7218e5
Fix atom.setSize spec when window is full screen
May 12, 2017
5a9582e
Silence error output in test
May 12, 2017
ffd154e
Fix lint errors
May 12, 2017
e62d1b9
Unspy Date.now when jasmine.useRealClock is called
May 12, 2017
3c34e3f
Upgrade packages so tests pass with a mocked Date.now
May 12, 2017
0d4e2b3
Fix editor component tests on Windows
May 12, 2017
5848e9b
:arrow_up: first-mate
May 12, 2017
9653399
Fix editor element tests on Windows
May 12, 2017
4c5127c
Update foldable icon when a row's foldability changes
May 16, 2017
ad6202c
Show foldable icon on the last screen row belonging to a buffer row
May 16, 2017
3b3505d
Always allow to destroy free-form folds from the gutter
May 16, 2017
d44876f
Merge branch 'master' into tj-upgrade-electron
May 16, 2017
b15a59a
:arrow_up: text-buffer
May 16, 2017
a106a3b
:art:
May 16, 2017
dad08f2
:arrow_up: bracket-matcher
May 16, 2017
2c35005
Use custom snapshot row translation to prevent Electron 1.6 reload crash
May 19, 2017
d158e44
Merge branch 'master' into tj-upgrade-electron
May 19, 2017
a7066e3
Fix lint errors
May 19, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion benchmarks/text-editor-large-file-construction.bench.js
Expand Up @@ -26,7 +26,7 @@ export default async function ({test}) {

let t0 = window.performance.now()
const buffer = new TextBuffer({text})
const editor = new TextEditor({buffer, largeFileMode: true})
const editor = new TextEditor({buffer, autoHeight: false, largeFileMode: true})
atom.workspace.getActivePane().activateItem(editor)
let t1 = window.performance.now()

Expand Down
2 changes: 1 addition & 1 deletion benchmarks/text-editor-long-lines.bench.js
Expand Up @@ -33,7 +33,7 @@ export default async function ({test}) {

let t0 = window.performance.now()
const buffer = new TextBuffer({text})
const editor = new TextEditor({buffer, largeFileMode: true})
const editor = new TextEditor({buffer, autoHeight: false, largeFileMode: true})
editor.setGrammar(atom.grammars.grammarForScopeName('source.js'))
atom.workspace.getActivePane().activateItem(editor)
let t1 = window.performance.now()
Expand Down
24 changes: 15 additions & 9 deletions package.json
Expand Up @@ -12,7 +12,7 @@
"url": "https://github.com/atom/atom/issues"
},
"license": "MIT",
"electronVersion": "1.3.15",
"electronVersion": "1.6.9",
"dependencies": {
"async": "0.2.6",
"atom-keymap": "8.1.2",
Expand All @@ -27,9 +27,10 @@
"color": "^0.7.3",
"dedent": "^0.6.0",
"devtron": "1.3.0",
"etch": "^0.12.4",
"event-kit": "^2.3.0",
"find-parent-dir": "^0.3.0",
"first-mate": "7.0.4",
"first-mate": "7.0.6",
"fs-plus": "^3.0.0",
"fstream": "0.1.24",
"fuzzaldrin": "^2.1",
Expand All @@ -40,7 +41,7 @@
"jasmine-tagged": "^1.1.4",
"key-path-helpers": "^0.4.0",
"less-cache": "1.1.0",
"line-top-index": "0.2.0",
"line-top-index": "0.3.1",
"marked": "^0.3.6",
"minimatch": "^3.0.3",
"mocha": "2.5.1",
Expand All @@ -64,7 +65,7 @@
"sinon": "1.17.4",
"@atom/source-map-support": "^0.3.4",
"temp": "^0.8.3",
"text-buffer": "11.4.1",
"text-buffer": "12.1.4",
"typescript-simple": "1.0.0",
"underscore-plus": "^1.6.6",
"winreg": "^1.2.1",
Expand Down Expand Up @@ -94,15 +95,15 @@
"autosave": "0.24.3",
"background-tips": "0.27.0",
"bookmarks": "0.44.4",
"bracket-matcher": "0.85.5",
"bracket-matcher": "0.85.6",
"command-palette": "0.40.4",
"dalek": "0.2.1",
"deprecation-cop": "0.56.7",
"dev-live-reload": "0.47.1",
"encoding-selector": "0.23.3",
"exception-reporting": "0.41.4",
"find-and-replace": "0.208.1",
"fuzzy-finder": "1.5.6",
"fuzzy-finder": "1.5.7",
"github": "0.1.1",
"git-diff": "1.3.6",
"go-to-line": "0.32.1",
Expand All @@ -113,7 +114,7 @@
"line-ending-selector": "0.6.3",
"link": "0.31.3",
"markdown-preview": "0.159.12",
"metrics": "1.2.3",
"metrics": "1.2.4",
"notifications": "0.67.1",
"open-on-github": "1.2.1",
"package-generator": "1.1.1",
Expand All @@ -125,7 +126,7 @@
"symbols-view": "0.116.0",
"tabs": "0.106.0",
"timecop": "0.36.0",
"tree-view": "0.217.0-7",
"tree-view": "0.217.0-8",
"update-package-dependencies": "0.12.0",
"welcome": "0.36.3",
"whitespace": "0.36.2",
Expand Down Expand Up @@ -185,7 +186,12 @@
"spyOn",
"waitsFor",
"waitsForPromise",
"indexedDB"
"indexedDB",
"IntersectionObserver",
"FocusEvent",
"requestAnimationFrame",
"HTMLElement",
"snapshotResult"
]
}
}
6 changes: 3 additions & 3 deletions script/package.json
Expand Up @@ -7,10 +7,10 @@
"coffeelint": "1.15.7",
"colors": "1.1.2",
"csslint": "1.0.2",
"donna": "1.0.13",
"electron-chromedriver": "~1.3",
"donna": "1.0.16",
"electron-chromedriver": "~1.6",
"electron-link": "0.0.24",
"electron-mksnapshot": "~1.3",
"electron-mksnapshot": "~1.6",
"electron-packager": "7.3.0",
"electron-winstaller": "2.5.2",
"fs-extra": "0.30.0",
Expand Down
100 changes: 66 additions & 34 deletions spec/atom-environment-spec.coffee
Expand Up @@ -29,10 +29,12 @@ describe "AtomEnvironment", ->
atom.setSize(originalSize.width, originalSize.height)

it 'sets the size of the window, and can retrieve the size just set', ->
newWidth = originalSize.width + 12
newHeight = originalSize.height + 23
atom.setSize(newWidth, newHeight)
expect(atom.getSize()).toEqual width: newWidth, height: newHeight
newWidth = originalSize.width - 12
newHeight = originalSize.height - 23
waitsForPromise ->
atom.setSize(newWidth, newHeight)
runs ->
expect(atom.getSize()).toEqual width: newWidth, height: newHeight

describe ".isReleasedVersion()", ->
it "returns false if the version is a SHA and true otherwise", ->
Expand Down Expand Up @@ -221,44 +223,70 @@ describe "AtomEnvironment", ->
atom.loadState().then (state) -> expect(state).toEqual(serializedState)

it "saves state when the CPU is idle after a keydown or mousedown event", ->
spyOn(atom, 'saveState')
atomEnv = new AtomEnvironment({
applicationDelegate: global.atom.applicationDelegate,
})
idleCallbacks = []
spyOn(window, 'requestIdleCallback').andCallFake (callback) -> idleCallbacks.push(callback)
atomEnv.initialize({
window: {
requestIdleCallback: (callback) -> idleCallbacks.push(callback),
addEventListener: ->
removeEventListener: ->
},
document: document.implementation.createHTMLDocument()
})

spyOn(atomEnv, 'saveState')

keydown = new KeyboardEvent('keydown')
atom.document.dispatchEvent(keydown)
advanceClock atom.saveStateDebounceInterval
atomEnv.document.dispatchEvent(keydown)
advanceClock atomEnv.saveStateDebounceInterval
idleCallbacks.shift()()
expect(atom.saveState).toHaveBeenCalledWith({isUnloading: false})
expect(atom.saveState).not.toHaveBeenCalledWith({isUnloading: true})
expect(atomEnv.saveState).toHaveBeenCalledWith({isUnloading: false})
expect(atomEnv.saveState).not.toHaveBeenCalledWith({isUnloading: true})

atom.saveState.reset()
atomEnv.saveState.reset()
mousedown = new MouseEvent('mousedown')
atom.document.dispatchEvent(mousedown)
advanceClock atom.saveStateDebounceInterval
atomEnv.document.dispatchEvent(mousedown)
advanceClock atomEnv.saveStateDebounceInterval
idleCallbacks.shift()()
expect(atom.saveState).toHaveBeenCalledWith({isUnloading: false})
expect(atom.saveState).not.toHaveBeenCalledWith({isUnloading: true})
expect(atomEnv.saveState).toHaveBeenCalledWith({isUnloading: false})
expect(atomEnv.saveState).not.toHaveBeenCalledWith({isUnloading: true})

atomEnv.destroy()

it "ignores mousedown/keydown events happening after calling unloadEditorWindow", ->
spyOn(atom, 'saveState')
atomEnv = new AtomEnvironment({
applicationDelegate: global.atom.applicationDelegate,
})
idleCallbacks = []
spyOn(window, 'requestIdleCallback').andCallFake (callback) -> idleCallbacks.push(callback)
atomEnv.initialize({
window: {
requestIdleCallback: (callback) -> idleCallbacks.push(callback),
addEventListener: ->
removeEventListener: ->
},
document: document.implementation.createHTMLDocument()
})

spyOn(atomEnv, 'saveState')

mousedown = new MouseEvent('mousedown')
atom.document.dispatchEvent(mousedown)
atom.unloadEditorWindow()
expect(atom.saveState).not.toHaveBeenCalled()
atomEnv.document.dispatchEvent(mousedown)
atomEnv.unloadEditorWindow()
expect(atomEnv.saveState).not.toHaveBeenCalled()

advanceClock atom.saveStateDebounceInterval
advanceClock atomEnv.saveStateDebounceInterval
idleCallbacks.shift()()
expect(atom.saveState).not.toHaveBeenCalled()
expect(atomEnv.saveState).not.toHaveBeenCalled()

mousedown = new MouseEvent('mousedown')
atom.document.dispatchEvent(mousedown)
advanceClock atom.saveStateDebounceInterval
atomEnv.document.dispatchEvent(mousedown)
advanceClock atomEnv.saveStateDebounceInterval
idleCallbacks.shift()()
expect(atom.saveState).not.toHaveBeenCalled()
expect(atomEnv.saveState).not.toHaveBeenCalled()

atomEnv.destroy()

it "serializes the project state with all the options supplied in saveState", ->
spyOn(atom.project, 'serialize').andReturn({foo: 42})
Expand Down Expand Up @@ -288,10 +316,13 @@ describe "AtomEnvironment", ->
}
)
})
atom2.initialize({document, window})
atom2.deserialize(atom.serialize())

expect(atom2.textEditors.getGrammarOverride(editor)).toBe('text.plain')

atom2.destroy()

describe "openInitialEmptyEditorIfNecessary", ->
describe "when there are no paths set", ->
beforeEach ->
Expand Down Expand Up @@ -452,11 +483,14 @@ describe "AtomEnvironment", ->
}
atomEnvironment = new AtomEnvironment({applicationDelegate: atom.applicationDelegate})
atomEnvironment.initialize({window, document: fakeDocument})
spyOn(atomEnvironment.packages, 'getAvailablePackagePaths').andReturn []
spyOn(atomEnvironment, 'displayWindow').andReturn Promise.resolve()
atomEnvironment.startEditorWindow()
atomEnvironment.unloadEditorWindow()
atomEnvironment.destroy()
spyOn(atomEnvironment.packages, 'loadPackages').andReturn(Promise.resolve())
spyOn(atomEnvironment.packages, 'activate').andReturn(Promise.resolve())
spyOn(atomEnvironment, 'displayWindow').andReturn(Promise.resolve())
waitsForPromise ->
atomEnvironment.startEditorWindow()
runs ->
atomEnvironment.unloadEditorWindow()
atomEnvironment.destroy()

describe "::whenShellEnvironmentLoaded()", ->
[atomEnvironment, envLoaded, spy] = []
Expand All @@ -471,21 +505,19 @@ describe "AtomEnvironment", ->
applicationDelegate: atom.applicationDelegate
updateProcessEnv: -> promise
atomEnvironment.initialize({window, document})
spyOn(atomEnvironment.packages, 'getAvailablePackagePaths').andReturn []
spyOn(atomEnvironment, 'displayWindow').andReturn Promise.resolve()
spy = jasmine.createSpy()
atomEnvironment.startEditorWindow()

afterEach ->
atomEnvironment.unloadEditorWindow()
atomEnvironment.destroy()

it "is triggered once the shell environment is loaded", ->
atomEnvironment.whenShellEnvironmentLoaded spy
atomEnvironment.updateProcessEnvAndTriggerHooks()
envLoaded()
runs -> expect(spy).toHaveBeenCalled()

it "triggers the callback immediately if the shell environment is already loaded", ->
atomEnvironment.updateProcessEnvAndTriggerHooks()
envLoaded()
runs ->
atomEnvironment.whenShellEnvironmentLoaded spy
Expand Down
4 changes: 2 additions & 2 deletions spec/atom-reporter.coffee
Expand Up @@ -21,8 +21,8 @@ formatStackTrace = (spec, message='', stackTrace) ->
lines.shift() if message.trim() is errorMatch?[1]?.trim()

for line, index in lines
# Remove prefix of lines matching: at .<anonymous> (path:1:2)
prefixMatch = line.match(/at \.<anonymous> \(([^)]+)\)/)
# Remove prefix of lines matching: at jasmine.Spec.<anonymous> (path:1:2)
prefixMatch = line.match(/at jasmine\.Spec\.<anonymous> \(([^)]+)\)/)
line = "at #{prefixMatch[1]}" if prefixMatch

# Relativize locations to spec directory
Expand Down
1 change: 1 addition & 0 deletions spec/babel-spec.coffee
Expand Up @@ -43,6 +43,7 @@ describe "Babel transpiler support", ->

describe "when a .js file does not start with 'use babel';", ->
it "does not transpile it using babel", ->
spyOn(console, 'error')
expect(-> require('./fixtures/babel/invalid.js')).toThrow()

it "does not try to log to stdout or stderr while parsing the file", ->
Expand Down