Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Refactor addEditBookmarkHanger.js with commonForm #8136

Merged
merged 1 commit into from
Apr 20, 2017
Merged

Refactor addEditBookmarkHanger.js with commonForm #8136

merged 1 commit into from
Apr 20, 2017

Conversation

luixxiul
Copy link
Contributor

@luixxiul luixxiul commented Apr 9, 2017

Closes #6040
Addresses #7989 #8010

  • Added CommonFormBookmarkHanger to commonForm.js

  • Added globalStyles.spacing.bookmarkHangerMaxWidth to global.js
    Max-width of the bookmark hanger was set to 350px. Also, setting white-space:normal makes it possible for lines to be wrapped.

  • Applied Dialog to addEditBookmarkHanger.js instead of addEditBookmark.js

  • Added cancel button with this.onClose as 'fa fa-close' was removed

  • Added const arrowUp and dialogHanger

  • Added styles.bookmarkHanger which is applied if !this.props.isModal

  • Copied CommonFormSection and CommonFormTitle from commonForm.js, adding CommonFormBookmarkHangerTitle to addEditBookmarkHanger.js
    The margin-top of the title should be reduced if this.props.isModal.

  • Changed backgroundColor of commonForm to #fff

  • Add zindex to elements on navigation bar to let tests pass
    The value was set to higher than that of dialog, which is 3000.

  • Updated test code

Also:

  • Replaced divs with sections
  • Removed styles from form.less
  • Removed wideButton from buttons
  • Added testIds to buttons

Auditors:

Test Plan 1:

  1. Open about:preferences
  2. Disable Home button
  3. Click the star icon on the URL bar
  4. Make sure the arrow up appears exactly under the star
  5. Open about:preferences
  6. Enable Home button
  7. Click the star icon again
  8. Make sure th arrow up appears exactly under the star

Test Plan 2:

  1. Open about:bookmarks
  2. Click the star icon on the URL bar
  3. Click "Done"
  4. Click the star icon again
  5. Click "Remove"
  6. Make sure the bookmark is successfully removed

Test Plan 3:

  1. Click "Add Folder" icon on about:bookmarks
  2. Click "Cancel"
  3. Make sure the dialog is closed

Test Plan 4:

  1. Create a bookmark folder on about:bookmarks
  2. Edit the folder via context menu on about:bookmarks
  3. Click "Remove"
  4. Make sure the folder is successfully removed

Test Plan 5:

  1. Click the star icon on about:bookmarks
  2. Click "Cancel"
  3. Make sure the dialog is closed
  4. Click the star icon again
  5. Create a bookmark
  6. Edit the bookmark via context menu
  7. Click "Remove"
  8. Make sure the bookmark is successfully removed
  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Ran git rebase -i to squash commits (if needed).

Test Plan:

@luixxiul
Copy link
Contributor Author

luixxiul commented Apr 9, 2017

Test plan 1

screenshot 2017-04-18 22 50 57 screenshot 2017-04-18 22 51 13

Test plan 2

screenshot 2017-04-09 14 25 20

screenshot 2017-04-09 14 25 28

Test plan 3

screenshot 2017-04-09 14 25 40

Test plan 4

screenshot 2017-04-09 14 25 58

Test plan 5

screenshot 2017-04-09 14 26 10

screenshot 2017-04-09 14 26 22

@bradleyrichter
Copy link
Contributor

@luixxiul Can you please find a way to add shadow to the triangle nub as part of this refactor? It is barely visible in it's current form.

@cezaraugusto
Copy link
Contributor

rebase pls

@luixxiul
Copy link
Contributor Author

@bradleyrichter I updated the arrow with box-shadow.

screenshot 2017-04-18 22 50 57 screenshot 2017-04-18 22 51 13

Copy link
Contributor

@bradleyrichter bradleyrichter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks much better. thanks!

Please also move the window up so the point of the nub is between the legs of the arrow button, similar to chrome.

@luixxiul
Copy link
Contributor Author

Please also move the window up so the point of the nub is between the legs of the arrow button, similar to chrome.

I tried but I cannot find an easy way of fixing it without changing default behavior (ie clicking the star button twice displays "edit bookmark" dialog); the fix should be related with z-index, which is out of scope of this PR, so I think it is a good idea to deal with the issue with another PR.

Without changing z-index you'll get this:

screenshot 2017-04-19 1 35 46

Copy link
Contributor

@cezaraugusto cezaraugusto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes looks great, so do tests, nice job here.

left some comments regarding naming, sorry if I'm being picky but it's a step forward standardization

})} data-l10n-id={this.heading} />
<CommonFormSection>
<div className={css(styles.bookmark__sectionWrapper)}>
<section>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++ for section

}
}

const styles = StyleSheet.create({
// Copied from commonForm.js
CommonFormSection: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use camelCase here?

// PR #7985
margin: `${globalStyles.spacing.dialogInsideMargin} 30px`
},
CommonFormTitle: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

@@ -98,6 +108,13 @@ const styles = StyleSheet.create({
maxWidth: globalStyles.spacing.dialogLargeWidth
},

CommonFormBookmarkHanger: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

@luixxiul
Copy link
Contributor Author

@cezaraugusto thanks for reviewing. I just missed the camel case stuff, will fix it later.

@luixxiul luixxiul force-pushed the refactoring-aphrodite branch from 66c6f33 to a278055 Compare April 19, 2017 14:08
@luixxiul
Copy link
Contributor Author

@cezaraugusto ready for re-review. If it looks good to you, please set ready-to-merge label. I will then squash the commits to merge the test plans and sign the commit with GPG, thanks!

Closes #6040
Addresses #7989

- Added CommonFormBookmarkHanger to commonForm.js
- Added globalStyles.spacing.bookmarkHangerMaxWidth to global.js
  Max-width of the bookmark hanger was set to 350px. Also, setting white-space:normal makes it possible for lines to be wrapped.

- Moved Dialog from addEditBookmark.js to addEditBookmarkHanger.js
- Added cancel button with this.onClose as 'fa fa-close' was removed

- Added const arrowUp and dialogHanger
- Added box-shadow to arrowUp

- Added styles.bookmarkHanger which is applied if !this.props.isModal
- Copied CommonFormSection and CommonFormTitle from commonForm.js, adding CommonFormBookmarkHangerTitle to addEditBookmarkHanger.js
  The margin-top of the title should be reduced if this.props.isModal.

- Changed backgroundColor of commonForm to #fff

- Add zindex to elements on navigation bar to let tests pass
  The value was set to higher than that of dialog, which is 3000.

- Updated test code

Also:
- Replaced divs with sections
- Removed styles from form.less
- Removed wideButton from buttons
- Added testIds to buttons (bookmarkHangerRemoveButton, bookmarkHangerCancelButton, bookmarkHangerDoneButton)
- Fixed camel cases

Auditors:

Test Plan 1:
1. Open about:preferences
2. Disable Home button
3. Click the star icon on the URL bar
4. Make sure the arrow up appears exactly under the star
5. Make sure the button appears under the icon
6. Open about:preferences
7. Enable Home button
8. Click the star icon again
9. Make sure th arrow up appears exactly under the star

Test Plan 2:
1. Open about:bookmarks
2. Click the star icon on the URL bar
3. Click "Done"
4. Click the star icon again
5. Click "Remove"
6. Make sure the bookmark is successfully removed

Test Plan 3:
1. Click "Add Folder" icon on about:bookmarks
2. Click "Cancel"
3. Make sure the dialog is closed

Test Plan 4:
1. Create a bookmark folder on about:bookmarks
2. Edit the folder via context menu on about:bookmarks
3. Click "Remove"
4. Make sure the folder is successfully removed

Test Plan 5:
1. Click the star icon on about:bookmarks
2. Click "Cancel"
3. Make sure the dialog is closed
4. Click the star icon again
5. Create a bookmark
6. Edit the bookmark via context menu
7. Click "Remove"
8. Make sure the bookmark is successfully removed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants