Skip to content

Commit

Permalink
Refactor: Minimal code for passing the Open Sans test #6
Browse files Browse the repository at this point in the history
  • Loading branch information
mkudamatsu committed Oct 29, 2019
1 parent 29e03cf commit 009d2a6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
28 changes: 16 additions & 12 deletions cypress/integration/uploadFontFile.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,25 @@ describe('Uploading a font file', () => {
cy.visit('http://localhost:3000');
});

it('Displays the font name', () => {
describe('Displays the font name', () => {

const fontFileName = 'OpenSans-Regular.ttf';
it('When it is Open Sans Regular', () => {

cy.fixture(fontFileName, 'binary')
.then(Cypress.Blob.binaryStringToBlob)
.then((fontFile) => {
cy.get('[data-test=fontFileUploader]').upload({
fileContent: fontFile,
fileName: fontFileName,
mimeType: 'font/ttf',
encoding: 'utf8'
const fontFileName = 'OpenSans-Regular.ttf';
const expectedFontName = 'Open Sans Regular';

cy.fixture(fontFileName, 'binary')
.then(Cypress.Blob.binaryStringToBlob)
.then((fontFile) => {
cy.get('[data-test=FontFileUploader]').upload({
fileContent: fontFile,
fileName: fontFileName,
mimeType: 'font/ttf',
encoding: 'utf8'
});
});
});

cy.contains('Open Sans Regular');
cy.contains(expectedFontName);
});
});
});
2 changes: 1 addition & 1 deletion src/components/FontFileUploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default class FontFileUploader extends React.Component {
return (
<div>
<input type="file"
data-test="fontFileUploader" />
data-test="FontFileUploader" />
</div>
);
}
Expand Down

0 comments on commit 009d2a6

Please sign in to comment.