This repository has been archived by the owner on Dec 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 975
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #3001 Test plan for unpinning topSites: * Pin a topSite * Check that there are a pinned icon * Hover over topSite * Check that there are a minus icon * Hit minus icon * Pinned icon should be removed
- Loading branch information
1 parent
9ef1d63
commit dbe041d
Showing
40 changed files
with
1,267 additions
and
92 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
const React = require('react') | ||
const cx = require('../../lib/classSet.js') | ||
const DragSource = require('react-dnd').DragSource | ||
const DropTarget = require('react-dnd').DropTarget | ||
|
||
const Types = { | ||
BLOCK: 'block' | ||
} | ||
|
||
const blockSource = { | ||
/** | ||
* Required. Called when the dragging starts | ||
* It's the only data available to the drop targets about the drag source | ||
* @see http://gaearon.github.io/react-dnd/docs-drag-source.html#specification-methods | ||
*/ | ||
beginDrag (props) { | ||
return { | ||
id: props.id | ||
} | ||
} | ||
} | ||
|
||
const blockTarget = { | ||
/** | ||
* Optional. Called when an item is hovered over the component | ||
* @see http://gaearon.github.io/react-dnd/docs-drop-target.html#specification-methods | ||
*/ | ||
hover (props, monitor) { | ||
const draggedId = monitor.getItem().id | ||
if (draggedId !== props.id) { | ||
props.onDraggedSite(draggedId, props.id) | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Both sourceCollect and targetCollect are called *Collecting Functions* | ||
* They will be called by React DnD with a connector that lets you connect | ||
* nodes to the DnD backend, and a monitor to query information about the drag state. | ||
* It should return a plain object of props to inject into your component. | ||
* | ||
* @see http://gaearon.github.io/react-dnd/docs-drop-target.html#the-collecting-function | ||
*/ | ||
|
||
const sourceCollect = (connect, monitor) => { | ||
return { | ||
connectDragSource: connect.dragSource(), | ||
isDragging: monitor.isDragging() | ||
} | ||
} | ||
|
||
const targetCollect = (connect) => { | ||
return { | ||
connectDropTarget: connect.dropTarget() | ||
} | ||
} | ||
|
||
class Block extends React.Component { | ||
render () { | ||
const { isDragging, connectDragSource, connectDropTarget, onBookmarkedTopSite, isBookmarked, onPinnedTopSite, isPinned, onIgnoredTopSite, title, href, style, favicon } = this.props | ||
const opacity = isDragging ? 0 : 1 | ||
const starIcon = isBookmarked ? 'fa-star' : 'fa-star-o' | ||
const pinIcon = isPinned ? 'fa-minus' : 'fa-thumb-tack' | ||
|
||
return connectDragSource(connectDropTarget( | ||
<div className='topSiteSquareSpace'> | ||
<div | ||
className='topSitesElement' | ||
style={{ | ||
opacity: opacity | ||
}} | ||
> | ||
<div className='topSitesActionContainer'> | ||
<button | ||
className={cx({ | ||
topSitesActionBtn: true, | ||
fa: true, | ||
[starIcon]: true | ||
})} | ||
onClick={onBookmarkedTopSite} | ||
data-l10n-id={isBookmarked ? 'removeBookmarkButton' : 'addBookmarkButton'} | ||
/> | ||
<button | ||
className={cx({ | ||
topSitesActionBtn: true, | ||
fa: true, | ||
[pinIcon]: true | ||
})} | ||
onClick={onPinnedTopSite} | ||
data-l10n-id={isPinned ? 'pinTopSiteButton' : 'unpinTopSiteButton'} | ||
/> | ||
<button | ||
className='topSitesActionBtn fa fa-close' | ||
onClick={onIgnoredTopSite} | ||
data-l10n-id='removeTopSiteButton' | ||
/> | ||
</div> | ||
<a | ||
className='topSitesElementFavicon' | ||
title={title} | ||
href={href} | ||
style={style} | ||
> | ||
{isPinned ? <div className='pinnedTopSite'><span className='pin fa fa-thumb-tack' /></div> : null} | ||
{favicon} | ||
</a> | ||
</div> | ||
</div> | ||
)) | ||
} | ||
} | ||
|
||
/** | ||
* Wraps the component to make it draggable | ||
* Only the drop targets registered for the same type will | ||
* react to the items produced by this drag source. | ||
* | ||
* @see http://gaearon.github.io/react-dnd/docs-drag-source.html | ||
*/ | ||
const source = DragSource(Types.BLOCK, blockSource, sourceCollect)(Block) | ||
|
||
/** | ||
* React to the compatible items being dragged, hovered, or dropped on it | ||
* Works with the same parameters as DragSource() above. | ||
* | ||
* @see http://gaearon.github.io/react-dnd/docs-drop-target.html | ||
*/ | ||
const block = DropTarget(Types.BLOCK, blockTarget, targetCollect)(source) | ||
|
||
// Notice that we're exporting the DropTarget and not Block Class. | ||
module.exports = block |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
const React = require('react') | ||
|
||
class FooterInfo extends React.Component { | ||
constructor () { | ||
super() | ||
this.state = {} | ||
} | ||
|
||
render () { | ||
return <footer className='footerContainer'> | ||
<div className='copyrightNotice'> | ||
<div className='copyrightCredits'> | ||
<span className='photoBy' data-l10n-id='photoBy' /> <a className='copyrightOwner' href={this.props.photographerLink} target='_blank'>{this.props.photographer}</a> | ||
</div> | ||
<span className='photoName'>{this.props.photoName}</span> | ||
</div> | ||
<nav className='shortcutsContainer'> | ||
<a className='shortcutIcon settingsIcon' href={this.props.settingsPage} data-l10n-id='preferencesPage' /> | ||
<a className='shortcutIcon bookmarksIcon' href={this.props.bookmarksPage} data-l10n-id='bookmarksPage' /> | ||
<a className='shortcutIcon historyIcon' href={this.props.historyPage} data-l10n-id='historyPage' /> | ||
</nav> | ||
</footer> | ||
} | ||
} | ||
module.exports = FooterInfo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
const React = require('react') | ||
const cx = require('../../lib/classSet.js') | ||
|
||
class siteRemovalNotification extends React.Component { | ||
constructor () { | ||
super() | ||
this.state = {} | ||
} | ||
|
||
render () { | ||
const { isActive, onUndoIgnoredTopSite, onRestoreAll, onCloseNotification } = this.props | ||
return <div | ||
className={cx({ | ||
siteRemovalNotification: true, | ||
active: isActive | ||
})}> | ||
<span className='notification' data-l10n-id='thumbRemoved' /> | ||
<span className='siteRemovalAction' onClick={onUndoIgnoredTopSite} data-l10n-id='undoRemoved' /> | ||
<span className='siteRemovalAction' onClick={onRestoreAll} data-l10n-id='restoreAll' /> | ||
<button className='fa fa-close' onClick={onCloseNotification} data-l10n-id='close' /> | ||
</div> | ||
} | ||
} | ||
module.exports = siteRemovalNotification |
Oops, something went wrong.