diff --git a/lib/static/components/modals/screenshot-accepter/header.js b/lib/static/components/modals/screenshot-accepter/header.js
index 3809e2d3a..25adf76cd 100644
--- a/lib/static/components/modals/screenshot-accepter/header.js
+++ b/lib/static/components/modals/screenshot-accepter/header.js
@@ -131,6 +131,7 @@ export default class ScreenshotAccepterHeader extends Component {
label="Show meta"
title="Show test meta info"
isActive={showMeta}
+ isDisabled={images.length === 0}
isSuiteControl={true}
extendClassNames="screenshot-accepter__show-meta-btn"
handler={onShowMeta}
diff --git a/lib/static/components/modals/screenshot-accepter/index.js b/lib/static/components/modals/screenshot-accepter/index.js
index 9a703d8fe..4701dc2ba 100644
--- a/lib/static/components/modals/screenshot-accepter/index.js
+++ b/lib/static/components/modals/screenshot-accepter/index.js
@@ -111,7 +111,7 @@ class ScreenshotAccepter extends Component {
/>
diff --git a/lib/static/components/modals/screenshot-accepter/meta.js b/lib/static/components/modals/screenshot-accepter/meta.js
index abe1d33af..914067904 100644
--- a/lib/static/components/modals/screenshot-accepter/meta.js
+++ b/lib/static/components/modals/screenshot-accepter/meta.js
@@ -6,21 +6,23 @@ import MetaInfoContent from '../../section/body/meta-info/content';
export default class ScreenshotAccepterMeta extends Component {
static propTypes = {
showMeta: PropTypes.bool.isRequired,
- resultId: PropTypes.string.isRequired
+ image: PropTypes.shape({
+ parentId: PropTypes.string
+ })
}
render() {
- const {showMeta, resultId} = this.props;
+ const {showMeta, image} = this.props;
- if (!showMeta) {
- return ();
+ if (!showMeta || !image) {
+ return null;
}
return (
diff --git a/lib/static/styles.css b/lib/static/styles.css
index db646f9f0..f2def3298 100644
--- a/lib/static/styles.css
+++ b/lib/static/styles.css
@@ -142,6 +142,10 @@ main.container {
border-color: #cebe7d;
}
+.button_checked[disabled] {
+ border-color: #ccc;
+}
+
.button.button_type_action {
background: #ffde5a;
}
diff --git a/test/unit/lib/static/components/modals/screenshot-accepter/header.js b/test/unit/lib/static/components/modals/screenshot-accepter/header.js
index 8bed14dc3..8ac20fd6e 100644
--- a/test/unit/lib/static/components/modals/screenshot-accepter/header.js
+++ b/test/unit/lib/static/components/modals/screenshot-accepter/header.js
@@ -340,6 +340,22 @@ describe('', () => {
});
});
+ describe('"Show meta" button', () => {
+ const metaSelector = '[label="Show meta"]';
+
+ it('should be disabled if there are no images to accept', () => {
+ const component = mkHeaderComponent({images: []});
+
+ assert.isTrue(component.find(metaSelector).prop('isDisabled'));
+ });
+
+ it('should be enabled if passed not empty "images" array', () => {
+ const component = mkHeaderComponent({images: [{id: 'img-1', parentId: 'res-1'}]});
+
+ assert.isFalse(component.find(metaSelector).prop('isDisabled'));
+ });
+ });
+
describe('"Close screenshot accepting mode" button', () => {
it('should call "onClose" handler on click', () => {
const onClose = sandbox.stub();
diff --git a/test/unit/lib/static/components/modals/screenshot-accepter/index.js b/test/unit/lib/static/components/modals/screenshot-accepter/index.js
index 9ae85371c..d07c8dd9e 100644
--- a/test/unit/lib/static/components/modals/screenshot-accepter/index.js
+++ b/test/unit/lib/static/components/modals/screenshot-accepter/index.js
@@ -202,7 +202,7 @@ describe('', () => {
ScreenshotAccepterMeta,
{
showMeta: false,
- resultId: 'res-1'
+ image
}
);
});
diff --git a/test/unit/lib/static/components/modals/screenshot-accepter/meta.js b/test/unit/lib/static/components/modals/screenshot-accepter/meta.js
new file mode 100644
index 000000000..aef254321
--- /dev/null
+++ b/test/unit/lib/static/components/modals/screenshot-accepter/meta.js
@@ -0,0 +1,42 @@
+import React from 'react';
+import proxyquire from 'proxyquire';
+import {mkConnectedComponent} from '../../utils';
+
+describe('', () => {
+ const sandbox = sinon.sandbox.create();
+ let ScreenshotAccepterMeta, MetaInfoContent;
+
+ const mkMetaComponent = (props = {}) => {
+ return mkConnectedComponent();
+ };
+
+ 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());
+ });
+ });
+});