-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #452 from gemini-testing/sp.modalMetaView
fix(modal-view): do not crash on ScreenshotAccepterMeta render
- Loading branch information
Showing
7 changed files
with
72 additions
and
7 deletions.
There are no files selected for viewing
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
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
42 changes: 42 additions & 0 deletions
42
test/unit/lib/static/components/modals/screenshot-accepter/meta.js
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,42 @@ | ||
import React from 'react'; | ||
import proxyquire from 'proxyquire'; | ||
import {mkConnectedComponent} from '../../utils'; | ||
|
||
describe('<ScreenshotAccepterMeta/>', () => { | ||
const sandbox = sinon.sandbox.create(); | ||
let ScreenshotAccepterMeta, MetaInfoContent; | ||
|
||
const mkMetaComponent = (props = {}) => { | ||
return mkConnectedComponent(<ScreenshotAccepterMeta {...props} />); | ||
}; | ||
|
||
beforeEach(() => { | ||
MetaInfoContent = sandbox.stub().returns(null); | ||
|
||
ScreenshotAccepterMeta = proxyquire('lib/static/components/modals/screenshot-accepter/meta', { | ||
'../../section/body/meta-info/content': {default: MetaInfoContent} | ||
}).default; | ||
}); | ||
|
||
afterEach(() => sandbox.restore()); | ||
|
||
describe('should not render meta info', () => { | ||
it('if "showMeta" property is false', () => { | ||
const component = mkMetaComponent({ | ||
showMeta: false, | ||
image: {id: 'some-id'} | ||
}); | ||
|
||
assert.isEmpty(component.html()); | ||
}); | ||
|
||
it('if "image" property is empty', () => { | ||
const component = mkMetaComponent({ | ||
showMeta: true, | ||
image: null | ||
}); | ||
|
||
assert.isEmpty(component.html()); | ||
}); | ||
}); | ||
}); |