Commit graph

67 commits

Author SHA1 Message Date
Evan Morikawa d1c587a01c fix(spec): add support for async specs and disable misbehaving ones
More spec fixes

replace process.nextTick with setTimeout(fn, 0) for specs

Also added an unspy in the afterEach

Temporarily disable specs

fix(spec): start fixing specs

Summary:
This is the WIP fix to our spec runner.

Several tests have been completely commented out that will require
substantially more work to fix. These have been added to our sprint
backlog.

Other tests have been fixed to update to new APIs or to deal with genuine
bugs that were introduced without our knowing!

The most common non-trivial change relates to observing the `NylasAPI` and
`NylasAPIRequest`. We used to observe the arguments to `makeRequest`.
Unfortunately `NylasAPIRequest.run` is argumentless. Instead you can do:
`NylasAPIRequest.prototype.run.mostRecentCall.object.options` to get the
`options` passed into the object. the `.object` property grabs the context
of the spy when it was last called.

Fixing these tests uncovered several concerning issues with our test
runner. I spent a while tracking down why our participant-text-field-spec
was failling every so often. I chose that spec because it was the first
spec to likely fail, thereby requiring looking at the least number of
preceding files. I tried binary searching, turning on and off, several
files beforehand only to realize that the failure rate was not determined
by a particular preceding test, but rather the existing and quantity of
preceding tests, AND the number of console.log statements I had. There is
some processor-dependent race condition going on that needs further
investigation.

I also discovered an issue with the file-download-spec. We were getting
errors about it accessing a file, which was very suspicious given the code
stubs out all fs access. This was caused due to a spec that called an
async function outside ot a `waitsForPromise` block or a `waitsFor` block.
The test completed, the spies were cleaned up, but the downstream async
chain was still running. By the time the async chain finished the runner
was already working on the next spec and the spies had been restored
(causing the real fs access to run).

Juan had an idea to kill the specs once one fails to prevent cascading
failures. I'll implement this in the next diff update

Test Plan: npm test

Reviewers: juan, halla, jackie

Differential Revision: https://phab.nylas.com/D3501

Disable other specs

Disable more broken specs

All specs turned off till passing state

Use async-safe versions of spec functions

Add async test spec

Remove unused package code

Remove canary spec
2016-12-15 13:02:00 -05:00
Evan Morikawa e43de77708 fix(lint): update files to for new linter version 2016-11-15 10:20:39 -08:00
Ben Gotow 8e533a3854 es6(*): Actions, ConfigSchema => ES2016 2016-10-27 18:48:33 -07:00
Ben Gotow 0a56d30a22 es6(composer): Composer extensions => ES2016 2016-10-27 17:28:36 -07:00
Juan Tejada 645a032a50 fix(specs): Fix remaining broken specs 2016-10-27 11:44:19 -07:00
Juan Tejada da48d8433e fix(specs): Fix date input specs 2016-10-27 11:35:37 -07:00
Juan Tejada f2e7ea4c4c feat(reminders): Add send reminders functionality
Summary: Add reminders plugin which lets you set reminder if you don't get a reply for a message within a specified time in the future

Test Plan: TODO

Reviewers: halla, bengotow, evan

Reviewed By: halla, bengotow, evan

Differential Revision: https://phab.nylas.com/D3356
2016-10-27 08:49:29 -07:00
Ben Gotow 9ee3087d10 feat(tokens): Multi-select for tokenized text fields
Test Plan: Lots of tests, mostly updated to enzyme. Not many new ones.

Reviewers: evan, juan, jackie

Reviewed By: juan, jackie

Subscribers: juan

Differential Revision: https://phab.nylas.com/D3374
2016-10-26 13:58:57 -07:00
Ben Gotow c20238314d lint(*): Bump to ESLint 3.8 2016-10-17 18:07:35 -07:00
Evan Morikawa 0971f67e7f fix(linter) 2016-10-13 12:41:09 -04:00
Evan Morikawa de0f2374fe feat(calendar): can pick which calendars you want displayed
Summary:
Adds a resizable column next to the calendar that lets you pick which
calendars you want to turn on and off.

The picker sidebar styling mimics that of the main account sidebar.

Calendars are grouped by account.

We store the disabled calendars in in your config.

I added a `notIn` SQL method so it'll perform `WHERE calendarId NOT IN
['a', 'b', ...]` instead of `NOT (WHERE calendarId IN ['a', 'b', 'c'])`

I wanted it to be an exclusion (instead of inclusion) list so the default
was "all on" and we didn't need to always fetch the full list of
calendarIds from the database to compare against.

This also fixed a test that was failing constantly: The Query Subscription
Pool Spec was not being properly reset on each test. As a result, the test
would fail with an instance of a query subscription that Jasmine would
attempt to pretty print. Jasmine would fail to pretty print it because of
a jasmine bug that fails to properly display Objects with null prototypes.
The DatabaseStore's EventEmitter has a property with a null prototyp
causing the error

Test Plan: manual

Reviewers: bengotow, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D3336
2016-10-13 11:37:19 -04:00
Evan Morikawa b540bbb601 fix(composer): tokenizing text field trigger logic moved to composer 2016-10-02 12:05:31 -04:00
Ben Gotow 109fb21dc7 fix(thread-list): Use interaction handlers, don’t update selection directly 2016-09-27 16:31:28 -07:00
Ben Gotow e533d063d0 fix(specs): Fix tests that were console.logging, bump coffee-react 2016-09-20 15:17:48 -07:00
Juan Tejada 432fc99f3c fix(mail-merge): Skip row in table data if its empty
- Don't show annoying error if entire row is empty
- Just show error if just the email cell is empty
2016-07-28 14:05:51 -07:00
Annie c251884eaa fix(mail-merge): Fix column deletion and added a spec for uneven data
Summary: After importing an uneven csv (not all rows have the same number of columns e.g. rows: [[1,2][3,4,5]]), deleting the last column would improperly delete data in rows with fewer columns. This is because we were slicing each row based on row.length - 1 which is not the same for all rows. Fixed this by creating a new variable newNumColumns which is columns.length - 1.

Test Plan: Added new test data with uneven data and added a test in table-data-source-spec for removeLastColumn on this uneven set.

Reviewers: juan

Reviewed By: juan

Subscribers: juan

Differential Revision: https://phab.nylas.com/D3133
2016-07-28 12:12:10 -07:00
Juan Tejada f77cbc02f5 fix(mail-merge): Keep column links state properly in sync #2493
Summary:
See https://phab.nylas.com/D3112 for full description
- Update EditorAPI.insertCustomComponent to take a pre-generated
anchorId

Test Plan: Unit tests + manual

Reviewers: bengotow, halla, jackie

Reviewed By: jackie

Differential Revision: https://phab.nylas.com/D3113
2016-07-22 14:25:31 -07:00
Annie bd361c8abb refactor(signatures): Removed old signature imgs and made static empty signatures page
Summary:
Refactored signature preferences page to allow more signatures than the previous 1-1 mapping for signatures and accounts. Created a multi select dropdown of the accounts for which a certain signature is set as default for. Added a button into the draft header From field to toggle between saved signatures.

refactor(signatures): Add basic add/remove capabilities to static

refactor(signatures): Hooked up signature actions and signature store for basic functionality

fix(signatures): Cleaned up signature store and started on multiselectdropdown

fix(signatures): Add multi signature toggle select to multiselect dropdown

build(signatures): Built framework for multiselect dropdown

build(signatures): Toggle button functionality for dropdown

build(signatures): Build multi select from components and add debounce

refactor(signatures): Move signature actions and signature store into flux

fix(signatures): Styled composer signatures button/dropdown and fixed preferences checkmarks

build(signatures): Finish main functionality, about to refactor composer signature button into injected component

fix(signatures): Changed position styles

fix(signatures): Fixed background color for dropdown button when blurred

build(signatures): Began to write tests for signatures store, preferences and dropdown

Test Plan: Wrote tests for preferences signatures, signature store, signature composer dropdown and refactored tests for signature composer extension. For signature composer extension I removed applyTransformsToDraft and unapplyTransformsToDraft and tested by sending emails with signatures to different providers to make sure the <signature> tag caused problems.

Reviewers: bengotow, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D3073
2016-07-11 12:35:41 -07:00
Juan Tejada 8d84ef9fab fix(build): Fix linter errors 2016-05-11 16:38:30 -07:00
Juan Tejada ab55bc68ea fix(build): Fix lint issues and specs 2016-05-11 15:33:52 -07:00
Juan Tejada eb79ce9d44 specs(table): Add specs for table components
Summary:
- Add some docs to Table components
- Updates Table components to use a TableDataSource instead of accessing arrays, cleans up code a bit
- Add enzyme lib to have a cleaner and simpler api to write tests for React Components
- Updates decorators to extend from the BaseComponent instead of vanilla Component, this way instance methods are still available on composed components

Test Plan: - Unit tests

Reviewers: evan, bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2941
2016-05-11 14:36:59 -07:00
Evan Morikawa e1f689de6f fix(spec): fix injected component spec 2016-05-06 16:42:55 -07:00
Ben Gotow d961b1e4d4 fix(lint): Correct more linter errors 2016-05-06 14:10:28 -07:00
Evan Morikawa 837627aa39 feat(babel6): 1,774 linter errors 2016-05-06 11:55:46 -07:00
Evan Morikawa 50f301e845 feat(babel6): fix es6 describe function syntax 2016-05-06 11:55:20 -07:00
Evan Morikawa b7eb359707 feat(babel6): fix participant field spec 2016-05-06 11:55:16 -07:00
Evan Morikawa 47c064617d feat(babel6): Fix destructuring default from exports and update linter 2016-05-06 11:55:14 -07:00
Evan Morikawa aa6020c871 feat(babel6): Fix FixedPopover spec 2016-05-06 11:55:12 -07:00
Evan Morikawa 7f50074c0d feat(babel6): Convert to use new es6 require syntax 2016-05-06 11:54:55 -07:00
Juan Tejada ea9538f444 feat(mail-merge): Add CSV imports, styling, and several fixes
Summary: Adds CSV imports, proper styles to mail merge plugin and fixes a handful of bugs

Test Plan: TODO

Reviewers: bengotow, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D2925
2016-04-27 18:22:32 -07:00
Evan Morikawa 1984940af2 fix(frame): fix link clicking in iframes 2016-04-25 17:30:30 -07:00
Juan Tejada a24e3444fd fix(specs): Fix broken popover specs
- Remove composition with decorator for now
- Fix other specs
2016-04-24 11:08:33 -07:00
Ben Gotow a48ddd51f8 refactor(menus): Major prune of keymaps/commands, real conditional menus
Summary:
Keymaps & menus CSON => JSON, remove AtomKeymaps, CommandRegistry use of CSS selectors, use Mousetrap instead

Important Notes:

- The `application:` prefix is reserved for commands which are handled in the application process. Don't use it for other things. You will not receive the events in the window.

- Maintaining dynamic menus seems to come with quite an overhead, because Electron updates the entire menu every time. In the future, we'll need https://github.com/electron/electron/issues/528 to really make things nice. I will be tracking this upstream.

- The format for keyboard shortcuts has changed. `cmd-X` is now `command+shift+x`

Test Plan: Run tests

Reviewers: juan, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D2917
2016-04-24 12:16:25 -05:00
Evan Morikawa b29d5ac75b tests(calendar): adding calendar and scheduler tests
Summary: Adding tests

Test Plan: Tests

Reviewers: juan, bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2892
2016-04-19 11:54:15 -07:00
Ben Gotow 36ab9d593b feat(unread/spam): New items in the sidebar for unread and spam
Summary:
Adds a new unified "Spam" folder and a unified "Unread" view,
which shows all the messages in your inbox which are unread.

Test Plan: Run tests

Reviewers: evan, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D2901
2016-04-19 11:32:33 -07:00
Dakota Nelson ccaa03e944 Expose ParticipantsTextField through component kit (#1994) 2016-04-18 16:39:08 -07:00
Ben Gotow 5a9d6c9eba bump(react) 0.14.7 => 15.0.1 2016-04-12 16:58:45 -07:00
Ben Gotow b4434f6617 fix(focus): Remove focusedField in favor of imperative focus, break apart ComposerView
Summary:
- Removes controlled focus in the composer!
  - No React components ever perfom focus in lifecycle methods. Never again.
  - A new `Utils.schedule({action, after, timeout})` helper makes it easy to say "setState or load draft, etc. and then focus"
  - The DraftStore issues a focusDraft action after creating a draft, which causes the MessageList to focus and scroll to the desired composer, which itself decides which field to focus.
  - The MessageList never focuses anything automatically.
- Refactors ComposerView apart — ComposerHeader handles all top fields, DraftSessionContainer handles draft session initialization and exposes props to ComposerView
  - ComposerHeader now uses a KeyCommandRegion (with focusIn and focusOut) to do the expanding and collapsing of the participants fields. May rename that container very soon.
- Removes all CommandRegistry handling of tab and shift-tab. Unless you preventDefault, the browser does it's thing.
- Removes all tabIndexes greater than 1. This is an anti-pattern—assigning everything a tabIndex of 0 tells the browser to move between them based on their order in the DOM, and is almost always what you want.
- Adds "TabGroupRegion" which allows you to create a tab/shift-tabbing group, (so tabbing does not leave the active composer). Can't believe this isn't a browser feature.

Todos:
- Occasionally, clicking out of the composer contenteditable requires two clicks. This is because atomicEdit is restoring selection within the contenteditable and breaking blur.
- Because the ComposerView does not render until it has a draft, we're back to it being white in popout composers for a brief moment. We will fix this another way - all the "return unless draft" statements were untenable.
- Clicking a row in the thread list no longer shifts focus to the message list and focuses the last draft. This will be restored soon.

Test Plan: Broken

Reviewers: juan, evan

Reviewed By: juan, evan

Differential Revision: https://phab.nylas.com/D2814
2016-04-04 15:22:01 -07:00
Ben Gotow 39768fd9d4 bump(react): 0.13.2 => 0.14.7
Great breakdown of React changes here:
https://github.com/facebook/react/blob/master/CHANGELOG.md#0140-october-7-2015

Due to deprecation warnings, I don't think this will break third-party extensions unless they were doing really bad things.
2016-03-29 01:43:12 -07:00
Juan Tejada c6acca8ca3 remove(popover): Remove Popover in favor of FixedPopover
Summary:
- FixedPopover now correctly adjusts itself when overflowing outside
  window, in all directions
  - Updates styles
  - Adds specs
- Remove Popover and popover.less, and refactor all code that used it in
  favor of the new FixedPopover

Test Plan: Unit tests

Reviewers: drew, evan, bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2697
2016-03-09 10:05:46 -08:00
Juan Tejada f46502ad3e test(plugins): Add snooze and send later specs
Summary:
- Also refactors the code a bit for testability and maintainability
- Fixes #1515

Test Plan: - Unit tests

Reviewers: evan, drew, bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2651
2016-03-03 12:38:42 -08:00
Juan Tejada 0cfa9848e7 fix(alias-list): Editable list wont create empty items
- Update alias coercion to include name by default
2016-02-01 12:45:52 -08:00
Evan Morikawa 8f384bb4e8 fix(quoted): fix quoted text issue with single blockquotes
Fixes #1084
Also fixes broken tokenizing text field specs
Also protects `MessageBodyExtension`s from errors
2016-01-28 17:25:36 -08:00
Juan Tejada 1aef74ce4a Fix MutliSelectSplitInteractionHandler specs 2016-01-22 13:47:54 -08:00
Juan Tejada abe363db19 Fix MultiSelectListInteractionHandlers specs 2016-01-21 17:07:57 -08:00
Ben Gotow ff01c3a502 DataView => ListDataSource 2016-01-14 12:26:54 -08:00
Evan Morikawa 92cd752284 feat(composer): can outdent blockquotes allowing you to reply inline
Summary:
You can now break up blockquotes (as in quoted text areas) by pressing
"delete" at the start of a line. This allows you to reply inline.

Test Plan: new tests

Reviewers: bengotow, juan

Reviewed By: bengotow, juan

Differential Revision: https://phab.nylas.com/D2421
2016-01-11 14:46:20 -05:00
Juan Tejada 73f76de7fc fix(composer-focus): Fix focus behavior + update InjectedComponent props
Summary:
- Fixes bug with Composer focus caused by injected component. The composer body
  was being focused, but the cursor remained at the beginning of the content
  instead of at the end. This was caused because the focus method was being
  called before the content had actually been rendered to the dom.
  - Adds a callback to check when injected comp was actually rendered, and uses
    that to focus the body at the correct time.
  - Updates specs
- Updates behavior of focusing composer body when selecting threads in split
  mode --  resolves #T3444
  - It will focus the body when a thread is selcted via a click
  - It wont focus the body when a thread is selected via arrow keys
  - It will focus the body when a new inline reply is created
  - Updates specs

Test Plan: - Unit tests

Reviewers: evan, bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2393
2015-12-29 21:28:15 -05:00
Ben Gotow af67597f0b feat(mail-rules): Per-account mail rules filter incoming, existing mail
Summary:
Originally, this was going to be a totally independent package, but
I wasn't able to isolate the functionality and get it tied in to
the delta-stream consumption. Here's how it currently works:

- The preferences package has a new tab which allows you to edit
  mail filters. Filters are saved in a new core store, and a new
  stock component (ScenarioEditor) renders the editor. The editor
  takes a set of templates that define a value space, and outputs
  a valid set of values.

- A new MailFilterProcessor takes messages and creates tasks to
  apply the actions from the MailFiltersStore.

- The worker-sync package now uses the MailFilterProcessor to
  apply filters /before/ it calls didPassivelyReceiveNewModels,
  so filtrs are applied before any notifications are created.

- A new task, ReprocessMailFiltersTask allows you to run filters
  on all of your existing mail. It leverages the existing TaskQueue
  architecture to: a) resume where it left off if you quit midway,
  b) be queryable (for status) from all windows and c) cancelable.
  The TaskQueue is a bit strange because it runs performLocal and
  performRemote very differently, and I had to use `performRemote`.
  (todo refactor soon.)

This diff also changes the EditableList a bit to behave like a
controlled component and render focused / unfocused states.

Test Plan: Run tests, only for actual filter processing atm.

Reviewers: juan, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D2379
2015-12-23 02:19:32 -05:00
Evan Morikawa d18642fb3e refactor(contenteditable): new ContenteditableExtension API
Summary:
This provides a new API for `ContenteditableExtension`s. Instead of
manually manipulating the raw DOM and `Selection` objects, there's a new
`Editor` interface that encapsulates it and provides helper methods.

You can now do:

      editor.select(someNode).createLink("foo").collapseToEnd()

Now raw methods like `execCommand` ONLY show up in the `Editor` interface
as well as most of the raw `Selection` APIs.

There are also more integration tests :)

Another major goal was cleaning up the contenteditable file itself. To
that end:

1. The DOMNormalizer got pulled out into its own extension
1. The TabManager is now its own extension
1. Url wrangling got moved into the FloatingToolbar control
1. There is now the concept of a `ContenteditableService`, which are
tightly-couple blocks of code separated out into logical units. These are
dependent on the core state, innerState, and props and are not full
extensions.
1. `MouseService` now handles all the click event logic
1. `ClipboardService` was modified to the new service architecture

Test Plan: script/grunt run-integration-tests

Reviewers: drew, juan, bengotow

Reviewed By: juan, bengotow

Differential Revision: https://phab.nylas.com/D2367
2015-12-21 19:58:01 -08:00