From 124c517056279ba8ae76756391b9d8a146ae1567 Mon Sep 17 00:00:00 2001 From: "KIM, JINWOOK" Date: Tue, 20 May 2014 23:50:12 +0900 Subject: [PATCH 1/7] Add Visual Studio 2010 SP1 download URL Many people are confused by indicating just Visual Studio 2010 Express without SP1 --- docs/build-instructions/windows.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/build-instructions/windows.md b/docs/build-instructions/windows.md index c589f152b..c525b3651 100644 --- a/docs/build-instructions/windows.md +++ b/docs/build-instructions/windows.md @@ -3,7 +3,7 @@ ## Requirements * Windows 7 or later - * [Visual C++ 2010 SP1 Express](http://www.visualstudio.com/en-us/downloads/download-visual-studio-vs#DownloadFamilies_4) + * [Visual C++ 2010 Express](http://www.visualstudio.com/en-us/downloads/download-visual-studio-vs#DownloadFamilies_4) and [SP1](http://www.microsoft.com/en-us/download/details.aspx?id=23691) * [node.js - 32bit](http://nodejs.org/download/) v0.10.x * [Python 2.7.x](http://www.python.org/download/) * [GitHub for Windows](http://windows.github.com/) From 65b1e13b834869753e9e39cb34bc40fc1c124396 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 20 May 2014 23:05:13 -0600 Subject: [PATCH 2/7] Use Atom-specific fork of React allowing selection restoration opt out This fork of React allows data-react-skip-selection-restoration to be defined on input elements, skipping costly selection restoration that occurs when the input element is focused during reconciliation. --- package.json | 4 ++-- src/cursor-component.coffee | 4 ++-- src/cursors-component.coffee | 4 ++-- src/editor-component.coffee | 4 ++-- src/editor-scroll-view-component.coffee | 4 ++-- src/gutter-component.coffee | 4 ++-- src/input-component.coffee | 4 ++-- src/lines-component.coffee | 4 ++-- src/react-editor-view.coffee | 2 +- src/scrollbar-component.coffee | 4 ++-- src/scrollbar-corner-component.coffee | 4 ++-- src/selection-component.coffee | 4 ++-- src/selections-component.coffee | 4 ++-- 13 files changed, 25 insertions(+), 25 deletions(-) diff --git a/package.json b/package.json index 0be14454a..6b25af561 100644 --- a/package.json +++ b/package.json @@ -45,8 +45,8 @@ "property-accessors": "^1", "q": "^1.0.1", "random-words": "0.0.1", - "react": "^0.10.0", - "reactionary": "^0.9.0", + "react-atom-fork": "^0.10.0", + "reactionary-atom-fork": "^0.9.0", "runas": "^0.5", "scandal": "0.15.2", "scoped-property-store": "^0.9.0", diff --git a/src/cursor-component.coffee b/src/cursor-component.coffee index 36ba33a08..902be9d28 100644 --- a/src/cursor-component.coffee +++ b/src/cursor-component.coffee @@ -1,5 +1,5 @@ -React = require 'react' -{div} = require 'reactionary' +React = require 'react-atom-fork' +{div} = require 'reactionary-atom-fork' module.exports = CursorComponent = React.createClass diff --git a/src/cursors-component.coffee b/src/cursors-component.coffee index bb43287ba..4d3e14deb 100644 --- a/src/cursors-component.coffee +++ b/src/cursors-component.coffee @@ -1,5 +1,5 @@ -React = require 'react' -{div} = require 'reactionary' +React = require 'react-atom-fork' +{div} = require 'reactionary-atom-fork' {debounce, toArray} = require 'underscore-plus' SubscriberMixin = require './subscriber-mixin' CursorComponent = require './cursor-component' diff --git a/src/editor-component.coffee b/src/editor-component.coffee index bf5904d53..5084920da 100644 --- a/src/editor-component.coffee +++ b/src/editor-component.coffee @@ -1,5 +1,5 @@ -React = require 'react' -{div, span} = require 'reactionary' +React = require 'react-atom-fork' +{div, span} = require 'reactionary-atom-fork' {debounce, defaults} = require 'underscore-plus' scrollbarStyle = require 'scrollbar-style' diff --git a/src/editor-scroll-view-component.coffee b/src/editor-scroll-view-component.coffee index 81b37ce8b..14a5363a0 100644 --- a/src/editor-scroll-view-component.coffee +++ b/src/editor-scroll-view-component.coffee @@ -1,5 +1,5 @@ -React = require 'react' -{div} = require 'reactionary' +React = require 'react-atom-fork' +{div} = require 'reactionary-atom-fork' {debounce} = require 'underscore-plus' InputComponent = require './input-component' diff --git a/src/gutter-component.coffee b/src/gutter-component.coffee index a72aba5f6..30a289c98 100644 --- a/src/gutter-component.coffee +++ b/src/gutter-component.coffee @@ -1,5 +1,5 @@ -React = require 'react' -{div} = require 'reactionary' +React = require 'react-atom-fork' +{div} = require 'reactionary-atom-fork' {isEqual, isEqualForProperties, multiplyString, toArray} = require 'underscore-plus' SubscriberMixin = require './subscriber-mixin' diff --git a/src/input-component.coffee b/src/input-component.coffee index ada93cf2a..372bccf9c 100644 --- a/src/input-component.coffee +++ b/src/input-component.coffee @@ -1,7 +1,7 @@ punycode = require 'punycode' {last, isEqual} = require 'underscore-plus' -React = require 'react' -{input} = require 'reactionary' +React = require 'react-atom-fork' +{input} = require 'reactionary-atom-fork' module.exports = InputComponent = React.createClass diff --git a/src/lines-component.coffee b/src/lines-component.coffee index 8b4dc29fa..17595e8dc 100644 --- a/src/lines-component.coffee +++ b/src/lines-component.coffee @@ -1,5 +1,5 @@ -React = require 'react' -{div, span} = require 'reactionary' +React = require 'react-atom-fork' +{div, span} = require 'reactionary-atom-fork' {debounce, isEqual, isEqualForProperties, multiplyString, toArray} = require 'underscore-plus' {$$} = require 'space-pen' diff --git a/src/react-editor-view.coffee b/src/react-editor-view.coffee index 87e5d0693..edc5c8425 100644 --- a/src/react-editor-view.coffee +++ b/src/react-editor-view.coffee @@ -1,5 +1,5 @@ {View, $} = require 'space-pen' -React = require 'react' +React = require 'react-atom-fork' EditorComponent = require './editor-component' {defaults} = require 'underscore-plus' diff --git a/src/scrollbar-component.coffee b/src/scrollbar-component.coffee index a4482f21d..19b477e3e 100644 --- a/src/scrollbar-component.coffee +++ b/src/scrollbar-component.coffee @@ -1,5 +1,5 @@ -React = require 'react' -{div} = require 'reactionary' +React = require 'react-atom-fork' +{div} = require 'reactionary-atom-fork' {extend, isEqualForProperties} = require 'underscore-plus' module.exports = diff --git a/src/scrollbar-corner-component.coffee b/src/scrollbar-corner-component.coffee index edcfc8389..d4650b453 100644 --- a/src/scrollbar-corner-component.coffee +++ b/src/scrollbar-corner-component.coffee @@ -1,5 +1,5 @@ -React = require 'react' -{div} = require 'reactionary' +React = require 'react-atom-fork' +{div} = require 'reactionary-atom-fork' module.exports = ScrollbarComponent = React.createClass diff --git a/src/selection-component.coffee b/src/selection-component.coffee index 8f4a1f20a..f4d47bd90 100644 --- a/src/selection-component.coffee +++ b/src/selection-component.coffee @@ -1,5 +1,5 @@ -React = require 'react' -{div} = require 'reactionary' +React = require 'react-atom-fork' +{div} = require 'reactionary-atom-fork' module.exports = SelectionComponent = React.createClass diff --git a/src/selections-component.coffee b/src/selections-component.coffee index 524f7236a..3b65ab42e 100644 --- a/src/selections-component.coffee +++ b/src/selections-component.coffee @@ -1,5 +1,5 @@ -React = require 'react' -{div} = require 'reactionary' +React = require 'react-atom-fork' +{div} = require 'reactionary-atom-fork' SelectionComponent = require './selection-component' module.exports = From 0fe3f2d03cfbef5ff856ceea8fae7504a4ab8e0f Mon Sep 17 00:00:00 2001 From: "KIM, JINWOOK" Date: Wed, 21 May 2014 22:11:59 +0900 Subject: [PATCH 3/7] Use 'with' instead of 'and' Using 'with' instead of 'and' could prevent some people to think that SP1 is an other program, or is Windows SP1 --- docs/build-instructions/windows.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/build-instructions/windows.md b/docs/build-instructions/windows.md index c525b3651..271a33d38 100644 --- a/docs/build-instructions/windows.md +++ b/docs/build-instructions/windows.md @@ -3,7 +3,7 @@ ## Requirements * Windows 7 or later - * [Visual C++ 2010 Express](http://www.visualstudio.com/en-us/downloads/download-visual-studio-vs#DownloadFamilies_4) and [SP1](http://www.microsoft.com/en-us/download/details.aspx?id=23691) + * [Visual C++ 2010 Express](http://www.visualstudio.com/en-us/downloads/download-visual-studio-vs#DownloadFamilies_4) with [SP1](http://www.microsoft.com/en-us/download/details.aspx?id=23691) * [node.js - 32bit](http://nodejs.org/download/) v0.10.x * [Python 2.7.x](http://www.python.org/download/) * [GitHub for Windows](http://windows.github.com/) From 421cdb41b9e1e6eb812ed4c6efeef9425520ccd9 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Wed, 21 May 2014 14:44:16 -0700 Subject: [PATCH 4/7] Add spec documentation --- docs/writing-specs.md | 61 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 docs/writing-specs.md diff --git a/docs/writing-specs.md b/docs/writing-specs.md new file mode 100644 index 000000000..61899d599 --- /dev/null +++ b/docs/writing-specs.md @@ -0,0 +1,61 @@ +# Writting specs + +Atom uses [Jasmine](http://jasmine.github.io/2.0/introduction.html) as its spec framework. Any new functionality should have specs to guard against regressions. + +## Create a new spec + +[Atom specs](https://github.com/atom/atom/tree/master/spec) and [package specs](https://github.com/atom/markdown-preview/tree/master/spec) are added to their respective `spec` directory. The example below creates a spec for Atom core. + +0. Create a spec file + + Spec files **must** end with `-spec` so add `sample-spec.coffee` to `atom/spec`. + +0. Add one or more `describe` method + + The `describe` method takes two arguments, a description and a function. If the description explains a behavior it typically begins with `when` if it is more like a unit test it begins with the method name. + + ```coffee + describe "when a test is written", -> + # contents + ``` + + or + + ```coffee + describe "Editor::moveUp", -> + # contents + ``` + +0. Add one or more `it` method + + The `it` method also takes two arugments, a description and a function. Try and make the description flow with the `it` method. For example, a description of `this should work` doesn't read well as `it this should work`. But a description of `should work` sounds great as `it should work`. + + ```coffee + describe "when a test is written", -> + it "has some expectations that should pass", -> + # Expectations + ``` + +0. Add one or more expectations + + The best way to learn about expectations is to read the [jamsine documentation](http://jasmine.github.io/2.0/introduction.html#section-Expectations) about them. Below is a simple example. + + ```coffee + describe "when a test is written", -> + it "has some expectations that should pass", -> + expect("apples").toEqual("apples") + expect("oranges").not.toEqual("apples") + ``` + +## Runnings specs + +Most of the time you'll want to run specs by triggering the `window:run-package-specs` command. This command is not only to run package specs, it is also for Atom core specs. This will run all the specs in the current project's spec directory. If you want to run the Atom core specs and **all** the default package specs trigger the `window:run-all-specs` command. + +To run a limited subset of specs use the `fdescribe` or `fit` methods. You can use those to focus a single spec or several specs. In the example above, focusing an individual spec looks like this: + +```coffee +describe "when a test is written", -> + fit "has some expectations that should pass", -> + expect("apples").toEqual("apples") + expect("oranges").not.toEqual("apples") +``` From 3a71b0470b4bcdbeb03289d2fec3401f29994667 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Wed, 21 May 2014 14:47:30 -0700 Subject: [PATCH 5/7] Add links to writing specs doc --- docs/index.md | 1 + docs/your-first-package.md | 2 ++ 2 files changed, 3 insertions(+) diff --git a/docs/index.md b/docs/index.md index 246675cd7..c513f1c20 100644 --- a/docs/index.md +++ b/docs/index.md @@ -5,6 +5,7 @@ * [Creating a Package](creating-a-package.md) * [Creating a Theme](creating-a-theme.md) * [Publishing a Package](publishing-a-package.md) +* [Writing Specs](writing-specs.md) * [Converting a TextMate Bundle](converting-a-text-mate-bundle.md) * [Converting a TextMate Theme](converting-a-text-mate-theme.md) * [Contributing](contributing.md) diff --git a/docs/your-first-package.md b/docs/your-first-package.md index 931380f51..4fc41d044 100644 --- a/docs/your-first-package.md +++ b/docs/your-first-package.md @@ -149,6 +149,8 @@ ASCII art professional! * [Getting your project on GitHub guide](http://guides.github.com/overviews/desktop) +* [Writing specs](writing-specs.md) for your package + * [Creating a package guide](creating-a-package.html) for more information on the mechanics of packages From 45eeee9aeabc438ebde8d9b97c78e7b9c3e6cd04 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki & Nathan Sobo Date: Wed, 21 May 2014 19:07:03 -0600 Subject: [PATCH 6/7] Ensure .lines div is always at least the height of the scroll view This ensures that the wrap guide extends the entire height of the editor. --- spec/editor-component-spec.coffee | 8 ++++++++ src/editor-component.coffee | 3 ++- src/editor-scroll-view-component.coffee | 5 +++-- src/lines-component.coffee | 10 +++++++--- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/spec/editor-component-spec.coffee b/spec/editor-component-spec.coffee index d6bddd95d..725c65b2d 100644 --- a/spec/editor-component-spec.coffee +++ b/spec/editor-component-spec.coffee @@ -90,6 +90,14 @@ describe "EditorComponent", -> expect(component.lineNodeForScreenRow(3).offsetTop).toBe 3 * lineHeightInPixels expect(component.lineNodeForScreenRow(4).offsetTop).toBe 4 * lineHeightInPixels + it "renders the .lines div at the full height of the editor if there aren't enough lines to scroll vertically", -> + editor.setText('') + node.style.height = '300px' + component.measureHeightAndWidth() + + linesNode = node.querySelector('.lines') + expect(linesNode.offsetHeight).toBe 300 + describe "when showInvisibles is enabled", -> invisibles = null diff --git a/src/editor-component.coffee b/src/editor-component.coffee index bf5904d53..d2971fb53 100644 --- a/src/editor-component.coffee +++ b/src/editor-component.coffee @@ -42,6 +42,7 @@ EditorComponent = React.createClass scrollWidth = editor.getScrollWidth() scrollTop = editor.getScrollTop() scrollLeft = editor.getScrollLeft() + scrollViewHeight = editor.getHeight() lineHeightInPixels = editor.getLineHeight() horizontalScrollbarHeight = editor.getHorizontalScrollbarHeight() verticalScrollbarWidth = editor.getVerticalScrollbarWidth() @@ -64,7 +65,7 @@ EditorComponent = React.createClass scrollTop, scrollLeft, scrollHeight, scrollWidth, @scrollingVertically, @cursorsMoved, @selectionChanged, @selectionAdded, cursorBlinkPeriod, cursorBlinkResumeDelay, @onInputFocused, @onInputBlurred, @mouseWheelScreenRow, - invisibles + invisibles, scrollViewHeight } ScrollbarComponent diff --git a/src/editor-scroll-view-component.coffee b/src/editor-scroll-view-component.coffee index 81b37ce8b..2f6b3a55d 100644 --- a/src/editor-scroll-view-component.coffee +++ b/src/editor-scroll-view-component.coffee @@ -17,7 +17,7 @@ EditorScrollViewComponent = React.createClass render: -> {editor, fontSize, fontFamily, lineHeight, showIndentGuide, invisibles} = @props - {renderedRowRange, pendingChanges, scrollTop, scrollLeft, scrollHeight, scrollWidth, scrollingVertically, mouseWheelScreenRow} = @props + {renderedRowRange, pendingChanges, scrollTop, scrollLeft, scrollHeight, scrollWidth, scrollViewHeight, scrollingVertically, mouseWheelScreenRow} = @props {selectionChanged, selectionAdded, cursorBlinkPeriod, cursorBlinkResumeDelay, cursorsMoved, onInputFocused, onInputBlurred} = @props if @isMounted() @@ -37,7 +37,8 @@ EditorScrollViewComponent = React.createClass LinesComponent { ref: 'lines', editor, fontSize, fontFamily, lineHeight, showIndentGuide, renderedRowRange, pendingChanges, scrollTop, scrollLeft, scrollingVertically, - selectionChanged, scrollHeight, scrollWidth, mouseWheelScreenRow, invisibles + selectionChanged, scrollHeight, scrollWidth, mouseWheelScreenRow, invisibles, + scrollViewHeight } componentDidMount: -> diff --git a/src/lines-component.coffee b/src/lines-component.coffee index 8b4dc29fa..419e25de3 100644 --- a/src/lines-component.coffee +++ b/src/lines-component.coffee @@ -15,9 +15,10 @@ LinesComponent = React.createClass render: -> if @isMounted() - {editor, scrollTop, scrollLeft, scrollHeight, scrollWidth, lineHeight} = @props + {editor, scrollTop, scrollLeft, scrollHeight, scrollWidth, lineHeight, scrollViewHeight} = @props + style = - height: scrollHeight + height: Math.max(scrollHeight, scrollViewHeight) width: scrollWidth WebkitTransform: "translate3d(#{-scrollLeft}px, #{-scrollTop}px, 0px)" @@ -35,7 +36,10 @@ LinesComponent = React.createClass shouldComponentUpdate: (newProps) -> return true if newProps.selectionChanged - return true unless isEqualForProperties(newProps, @props, 'renderedRowRange', 'fontSize', 'fontFamily', 'lineHeight', 'scrollTop', 'scrollLeft', 'showIndentGuide', 'scrollingVertically', 'invisibles') + return true unless isEqualForProperties(newProps, @props, + 'renderedRowRange', 'fontSize', 'fontFamily', 'lineHeight', 'scrollTop', 'scrollLeft', + 'showIndentGuide', 'scrollingVertically', 'invisibles', 'scrollViewHeight' + ) {renderedRowRange, pendingChanges} = newProps for change in pendingChanges From 7872e95561d68cf8b70d07af5c79117cd925c943 Mon Sep 17 00:00:00 2001 From: Aaron Raimist Date: Thu, 22 May 2014 10:03:45 -0500 Subject: [PATCH 7/7] Updates Jasmine link in CONTRIBUTING.md --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cf6d36a6b..86d60dc0f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -38,7 +38,7 @@ For more information on how to work with Atom's official packages, see [JavaScript](https://github.com/styleguide/javascript), and [CSS](https://github.com/styleguide/css) styleguides. * Include thoughtfully-worded, well-structured - [Jasmine](http://pivotal.github.com/jasmine) specs. + [Jasmine](http://jasmine.github.io/) specs. * Document new code based on the [Documentation Styleguide](#documentation-styleguide) * End files with a newline.