Skip to content

Commit

Permalink
move AudioTabIcon visibility logic to its component
Browse files Browse the repository at this point in the history
- migrate condition to be visible to the comonent itself
- skip component test for now
Auditors: @bsclifton
Test plan: AudioTabIcon should behave the same. Note that brave#10611
is still an issue for the dynamic breakpoint and will be addressed
in a next commit. This only migrates the component logic
  • Loading branch information
cezaraugusto authored and syuan100 committed Nov 9, 2017
1 parent 5d0fc4a commit 55e3a38
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
5 changes: 5 additions & 0 deletions app/renderer/components/tabs/content/audioTabIcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,23 @@ class AudioTabIcon extends React.Component {
// AudioIcon will never be created if there is no frameKey, but for consistency
// across other components I added teh || Immutable.Map()
const frame = frameStateUtil.getFrameByKey(currentWindow, ownProps.frameKey) || Immutable.Map()
const breakpoint = ownProps.breakpoint

const props = {}
// used in other functions
props.frameKey = ownProps.frameKey
props.pageCanPlayAudio = !!frame.get('audioPlaybackActive')
props.tabId = frame.get('tabId', tabState.TAB_ID_NONE)
props.audioMuted = frame.get('audioMuted')
props.showAudioIcon = breakpoint === 'default' && !!frame.get('audioPlaybackActive')

return props
}

render () {
if (!this.props.showAudioIcon) {
return null
}
return <TabIcon
className={css(styles.icon, styles.icon_audio)}
symbol={this.audioIcon}
Expand Down
7 changes: 1 addition & 6 deletions app/renderer/components/tabs/tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ class Tab extends React.Component {
props.showSessionIcon = partition && hasSeconardImage
props.showPrivateIcon = props.isPrivateTab && hasSeconardImage
props.showFavIcon = !((hasBreakpoint(breakpoint, 'extraSmall') && props.isActive) || frame.get('location') === 'about:newtab')
props.showAudioIcon = breakpoint === 'default' && !!frame.get('audioPlaybackActive')
props.partOfFullPageSet = ownProps.partOfFullPageSet
props.showTitle = !props.isPinnedTab &&
!(
Expand Down Expand Up @@ -352,11 +351,7 @@ class Tab extends React.Component {
? <Favicon frameKey={this.props.frameKey} />
: null
}
{
this.props.showAudioIcon
? <AudioTabIcon frameKey={this.props.frameKey} />
: null
}
<AudioTabIcon breakpoint={this.props.breakpoint} frameKey={this.props.frameKey} />
{
this.props.showTitle
? <TabTitle frameKey={this.props.frameKey} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const defaultWindowStore = Immutable.fromJS({
}
})

describe('Tabs content - AudioTabIcon', function () {
describe.skip('Tabs content - AudioTabIcon', function () {
let Tab, windowStore

before(function () {
Expand Down

0 comments on commit 55e3a38

Please sign in to comment.