Skip to content
This repository has been archived by the owner on Aug 19, 2022. It is now read-only.

Commit

Permalink
Add test for @media print
Browse files Browse the repository at this point in the history
  • Loading branch information
ianobermiller committed Jan 5, 2016
1 parent 3cf12b7 commit 658d3f2
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/__tests__/media-query-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,4 +192,36 @@ describe('Media query tests', () => {
expect(mql.addListener).to.have.been.calledOnce;
expect(mql.removeListener).to.have.been.calledOnce;
});

it('renders top level print styles as CSS', () => {
const matchMedia = sinon.spy(() => ({
addListener: () => {},
matches: true
}));

const ChildComponent = Radium(() =>
<span style={{'@media print': {color: 'black'}}} />
);

const TestComponent = Radium({matchMedia})(() =>
<StyleRoot>
<ChildComponent />
</StyleRoot>
);

const output = TestUtils.renderIntoDocument(<TestComponent />);

const span = getElement(output, 'span');
const className = span.className.trim();
expect(className).to.not.be.empty;

const style = getElement(output, 'style');
expectCSS(style, `
@media print{
.${className}{
color:black !important;
}
}
`);
});
});

0 comments on commit 658d3f2

Please sign in to comment.