Skip to content

Commit

Permalink
Merge develop into master branch (#131)
Browse files Browse the repository at this point in the history
* Calling welcome one time (#87)

Fixes #86

* Fix broken link to docs/README.md (#95)

* Fix broken link to docs/README.md

* Fix broken link in README.MD

The link to the docs was set to ./docs/index.md.
It was changed to ./docs/README,.md

* Fixes #93: Split lines in packaging documentation (#93) (#96)

* Fixes #99 : Implement Header component (#100)

* Fixes #89: Adds layout of home component (#102)

* Fixes #103: Implement HomeContent component (#104)

- Implement HomeContent component
- Add default route to be loaded when Deer loads

* Fixes #92: Add editor component (#105)

* Fixes #97: Implement Notelist component (#106)

* Fixes #98: Implement NoteItem component (#107)

* Fixes #108: Support selecting note in noteList (#109)

* Fixes #112: Update the packages that Deer depends on (#113)

* Fixes #114: Add isNewNoteDisabled property to header component (#115)

Add isNewNoteDisabled property to header component and an action to change it

* Fixes #111: Support adding new note (#116)

* Fixes #117: Improve current code (#118)

- Rename NoteList reducer and action to note as it's general and related to notes operations onl
- Let NoteEditor be rendered inside HomeContent component

* Fixes #119: Add save button (#120)

* Fixes #121: update note title when content is changed (#122)

* Fixes #123: Replace activeNote with activeNoteIndex (#124)

* Support saving and loading note (#126)

* Move editorState to activeNoteState

* Add save modal

* Add note status modal and support note saving

* support loading note

* Fixes #127: support deleting note (#128)

* Fixes #129: support testing (#130)

* Fixes #129: support testing
  • Loading branch information
abahmed authored Sep 16, 2018
1 parent 8d9386e commit 2a00c28
Show file tree
Hide file tree
Showing 62 changed files with 1,932 additions and 57 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ build
# Ignore Logs
logs
*.log

# coverage test directory
coverage
10 changes: 9 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
{
"extends": ["standard", "standard-react"]
"extends": ["standard", "standard-react"],
"settings": {
"react": {
"version": "16.4.0"
}
},
"env": {
"jest": true
}
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ build

# distribution directory
dist

# coverage test directory
coverage
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ install:
script:
- npm run lint
- npm run build
- npm run test
1 change: 1 addition & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ If you make a contribution here, you may add your name and email address here.
- Austin Daniel ([email protected])
- Bekir Durak ([email protected])
- Andrew Cheng ([email protected])
- Mahmoud Younes ([email protected])



Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@

### Getting started

Check [Our Docs](./docs/index.md) for **building** and **installing** instructions.
Check [Our Docs](./docs/README.md) for **building** and **installing** instructions.


If you would like to contribute to Deer, see [Our Docs](./docs/index.md) too.
If you would like to contribute to Deer, see [Our Docs](./docs/README.md) too.

### Get in touch!

Expand Down
5 changes: 5 additions & 0 deletions __mocks__/electron.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
remote: {
getGlobal: jest.fn()
}
}
3 changes: 3 additions & 0 deletions __mocks__/pouchdb-browser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = jest.fn(() => ({
name: 'test'
}))
1 change: 1 addition & 0 deletions __mocks__/uuid/v4.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = jest.fn(() => 'id-string')
28 changes: 28 additions & 0 deletions __tests__/actions/__snapshots__/header.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`header_actions setDeleteDisabled Dispatches the correct action and payload 1`] = `
Array [
Object {
"payload": true,
"type": "UPDATE_DELETE_NOTE_STATE",
},
]
`;

exports[`header_actions setNewNoteDisabled Dispatches the correct action and payload 1`] = `
Array [
Object {
"payload": true,
"type": "UPDATE_NEW_NOTE_STATE",
},
]
`;

exports[`header_actions setSaveDisabled Dispatches the correct action and payload 1`] = `
Array [
Object {
"payload": true,
"type": "UPDATE_SAVE_NOTE_STATE",
},
]
`;
10 changes: 10 additions & 0 deletions __tests__/actions/__snapshots__/modal.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`modal_actions toggleYesNoModal Dispatches the correct action and payload 1`] = `
Array [
Object {
"payload": "SAVE_NOTE",
"type": "TOGGLE_SAVE_MODAL",
},
]
`;
80 changes: 80 additions & 0 deletions __tests__/actions/__snapshots__/note.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`note_actions addNewNote Dispatches the correct action and payload 1`] = `
Array [
Object {
"type": "ADD_NOTE",
},
]
`;

exports[`note_actions deleteNoteFromList Dispatches the correct action and payload 1`] = `
Array [
Object {
"payload": 3,
"type": "DELETE_NOTE_FROM_LIST",
},
]
`;

exports[`note_actions loadNoteContent Dispatches the correct action and payload 1`] = `
Array [
Object {
"payload": Object {},
"type": "LOAD_NOTE_CONTENT",
},
]
`;

exports[`note_actions setActiveNoteIndex Dispatches the correct action and payload 1`] = `
Array [
Object {
"payload": 3,
"type": "SET_ACTIVE_NOTE",
},
]
`;

exports[`note_actions setNoteStatus Dispatches the correct action and payload 1`] = `
Array [
Object {
"payload": "SAVING_NOTE",
"type": "SET_NOTE_STATUS",
},
]
`;

exports[`note_actions updateActiveNoteState Dispatches the correct action and payload 1`] = `
Array [
Object {
"payload": Object {},
"type": "UPDATE_ACTIVE_NOTE_STATE",
},
]
`;

exports[`note_actions updateNoteList Dispatches the correct action and payload 1`] = `
Array [
Object {
"type": "UPDATE_NOTE_LIST",
},
]
`;

exports[`note_actions updateNoteRev Dispatches the correct action and payload 1`] = `
Array [
Object {
"payload": "a123-a123",
"type": "UPDATE_NOTE_REV",
},
]
`;

exports[`note_actions updateNoteTitle Dispatches the correct action and payload 1`] = `
Array [
Object {
"payload": "Hello world",
"type": "UPDATE_NOTE_TITLE",
},
]
`;
17 changes: 17 additions & 0 deletions __tests__/actions/__snapshots__/welcome.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`welcome_actions getNextLang Dispatches the correct action and payload 1`] = `
Array [
Object {
"type": "SET_NEXT_LANG",
},
]
`;

exports[`welcome_actions toggleFade Dispatches the correct action and payload 1`] = `
Array [
Object {
"type": "TOGGLE_FADE",
},
]
`;
34 changes: 34 additions & 0 deletions __tests__/actions/header.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import configureStore from 'redux-mock-store'

// Actions to be tested
import * as headerActions from '../../app/actions/header'

const mockStore = configureStore()
const store = mockStore()

describe('header_actions', () => {
beforeEach(() => {
store.clearActions()
})

describe('setNewNoteDisabled', () => {
test('Dispatches the correct action and payload', () => {
store.dispatch(headerActions.setNewNoteDisabled(true))
expect(store.getActions()).toMatchSnapshot()
})
})

describe('setSaveDisabled', () => {
test('Dispatches the correct action and payload', () => {
store.dispatch(headerActions.setSaveDisabled(true))
expect(store.getActions()).toMatchSnapshot()
})
})

describe('setDeleteDisabled', () => {
test('Dispatches the correct action and payload', () => {
store.dispatch(headerActions.setDeleteDisabled(true))
expect(store.getActions()).toMatchSnapshot()
})
})
})
22 changes: 22 additions & 0 deletions __tests__/actions/modal.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import configureStore from 'redux-mock-store'
import { ACTIONS } from '../../app/constants/actions'
import * as modalActions from '../../app/actions/modal'
jest.mock('../../__mocks__/pouchdb-browser')

const mockStore = configureStore()
const store = mockStore()

global.fetch = () => {}

describe('modal_actions', () => {
beforeEach(() => {
store.clearActions()
})

describe('toggleYesNoModal', () => {
test('Dispatches the correct action and payload', () => {
store.dispatch(modalActions.toggleYesNoModal(ACTIONS.SAVE_NOTE))
expect(store.getActions()).toMatchSnapshot()
})
})
})
77 changes: 77 additions & 0 deletions __tests__/actions/note.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import configureStore from 'redux-mock-store'

// Actions to be tested
import * as noteActions from '../../app/actions/note'
import { NOTE_STATUS } from '../../app/constants/noteStatus'

const mockStore = configureStore()
const store = mockStore()

describe('note_actions', () => {
beforeEach(() => {
store.clearActions()
})

describe('addNewNote', () => {
test('Dispatches the correct action and payload', () => {
store.dispatch(noteActions.addNewNote())
expect(store.getActions()).toMatchSnapshot()
})
})

describe('updateNoteList', () => {
test('Dispatches the correct action and payload', () => {
store.dispatch(noteActions.updateNoteList())
expect(store.getActions()).toMatchSnapshot()
})
})

describe('setActiveNoteIndex', () => {
test('Dispatches the correct action and payload', () => {
store.dispatch(noteActions.setActiveNoteIndex(3))
expect(store.getActions()).toMatchSnapshot()
})
})

describe('updateNoteTitle', () => {
test('Dispatches the correct action and payload', () => {
store.dispatch(noteActions.updateNoteTitle('Hello world'))
expect(store.getActions()).toMatchSnapshot()
})
})

describe('updateActiveNoteState', () => {
test('Dispatches the correct action and payload', () => {
store.dispatch(noteActions.updateActiveNoteState({}))
expect(store.getActions()).toMatchSnapshot()
})
})

describe('updateNoteRev', () => {
test('Dispatches the correct action and payload', () => {
store.dispatch(noteActions.updateNoteRev('a123-a123'))
expect(store.getActions()).toMatchSnapshot()
})
})

describe('setNoteStatus', () => {
test('Dispatches the correct action and payload', () => {
store.dispatch(noteActions.setNoteStatus(NOTE_STATUS.SAVING_NOTE))
expect(store.getActions()).toMatchSnapshot()
})
})

describe('loadNoteContent', () => {
test('Dispatches the correct action and payload', () => {
store.dispatch(noteActions.loadNoteContent({}))
expect(store.getActions()).toMatchSnapshot()
})
})

describe('deleteNoteFromList', () => {
test('Dispatches the correct action and payload', () => {
store.dispatch(noteActions.deleteNoteFromList(3))
expect(store.getActions()).toMatchSnapshot()
})
})
})
27 changes: 27 additions & 0 deletions __tests__/actions/welcome.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import configureStore from 'redux-mock-store'

// Actions to be tested
import * as welcomeActions from '../../app/actions/welcome'

const mockStore = configureStore()
const store = mockStore()

describe('welcome_actions', () => {
beforeEach(() => {
store.clearActions()
})

describe('getNextLang', () => {
test('Dispatches the correct action and payload', () => {
store.dispatch(welcomeActions.getNextLang())
expect(store.getActions()).toMatchSnapshot()
})
})

describe('toggleFade', () => {
test('Dispatches the correct action and payload', () => {
store.dispatch(welcomeActions.toggleFade())
expect(store.getActions()).toMatchSnapshot()
})
})
})
Loading

0 comments on commit 2a00c28

Please sign in to comment.