Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@govuk-react/caption

Package Overview
Dependencies
Maintainers
5
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@govuk-react/caption - npm Package Compare versions

Comparing version 0.7.0 to 0.7.1

8

es/stories.js

@@ -5,3 +5,3 @@ import React from 'react';

import { select, text, withKnobs } from '@storybook/addon-knobs/react';
import { WithDocsCustom } from '@govuk-react/storybook-components';
import { withDocsCustom } from '@govuk-react/storybook-components';
import Heading from '@govuk-react/heading';

@@ -13,3 +13,3 @@ import Caption, { CaptionWithKnobs } from './fixtures';

stories.addDecorator(withKnobs);
stories.addDecorator(WithDocsCustom(ReadMe));
stories.addDecorator(withDocsCustom(ReadMe));
examples.addDecorator(withKnobs);

@@ -20,4 +20,4 @@ stories.add('Component default', function () {

var arrTypography = Object.keys(TYPOGRAPHY_SCALE);
var captionOptions = Object.keys(CAPTION_SIZES).concat(arrTypography);
var headingOptions = Object.keys(HEADING_SIZES).concat(arrTypography);
var captionOptions = [].concat(Object.keys(CAPTION_SIZES), arrTypography);
var headingOptions = [].concat(Object.keys(HEADING_SIZES), arrTypography);
examples.add('Placed with a heading component', function () {

@@ -24,0 +24,0 @@ return React.createElement("div", null, React.createElement(Caption, {

@@ -5,2 +5,14 @@ import React from 'react';

describe('Caption', function () {
// Capture errors as we're expecting to throw some
// eslint-disable-next-line no-console
var nativeError = console.error;
beforeEach(function () {
jest.resetModules(); // eslint-disable-next-line no-console
console.error = function () {};
});
afterEach(function () {
// eslint-disable-next-line no-console
console.error = nativeError;
});
it('allows custom string-based font size without crashing', function () {

@@ -7,0 +19,0 @@ var sizes = ['XL', 'XLARGE', 'L', 'LARGE', 'M', 'MEDIUM'];

@@ -26,3 +26,3 @@ "use strict";

stories.addDecorator(_react3.withKnobs);
stories.addDecorator((0, _storybookComponents.WithDocsCustom)(_README.default));
stories.addDecorator((0, _storybookComponents.withDocsCustom)(_README.default));
examples.addDecorator(_react3.withKnobs);

@@ -33,4 +33,4 @@ stories.add('Component default', function () {

var arrTypography = Object.keys(_constants.TYPOGRAPHY_SCALE);
var captionOptions = Object.keys(_constants.CAPTION_SIZES).concat(arrTypography);
var headingOptions = Object.keys(_constants.HEADING_SIZES).concat(arrTypography);
var captionOptions = [].concat(Object.keys(_constants.CAPTION_SIZES), arrTypography);
var headingOptions = [].concat(Object.keys(_constants.HEADING_SIZES), arrTypography);
examples.add('Placed with a heading component', function () {

@@ -37,0 +37,0 @@ return _react.default.createElement("div", null, _react.default.createElement(_fixtures.default, {

@@ -12,2 +12,14 @@ "use strict";

describe('Caption', function () {
// Capture errors as we're expecting to throw some
// eslint-disable-next-line no-console
var nativeError = console.error;
beforeEach(function () {
jest.resetModules(); // eslint-disable-next-line no-console
console.error = function () {};
});
afterEach(function () {
// eslint-disable-next-line no-console
console.error = nativeError;
});
it('allows custom string-based font size without crashing', function () {

@@ -14,0 +26,0 @@ var sizes = ['XL', 'XLARGE', 'L', 'LARGE', 'M', 'MEDIUM'];

{
"name": "@govuk-react/caption",
"version": "0.7.0",
"version": "0.7.1",
"dependencies": {
"@govuk-react/constants": "^0.7.0",
"@govuk-react/lib": "^0.7.0",
"@govuk-react/constants": "^0.7.1",
"@govuk-react/lib": "^0.7.1",
"govuk-colours": "^1.0.3"

@@ -8,0 +8,0 @@ },

@@ -6,5 +6,3 @@ import React from 'react';

const CaptionWithKnobs = () => (
<Caption size={text('size', 'XL')}>{text('children', 'Heading text')}</Caption>
);
const CaptionWithKnobs = () => <Caption size={text('size', 'XL')}>{text('children', 'Heading text')}</Caption>;

@@ -11,0 +9,0 @@ export default Caption;

@@ -23,4 +23,3 @@ import styled from 'styled-components';

const marginStyle = actualSize > 19 ? { marginBottom: SPACING_POINTS[1] } : undefined;
const marginResponsiveStyle = actualSize === 24 ?
{ [MEDIA_QUERIES.TABLET]: { marginBottom: 0 } } : undefined;
const marginResponsiveStyle = actualSize === 24 ? { [MEDIA_QUERIES.TABLET]: { marginBottom: 0 } } : undefined;

@@ -36,3 +35,3 @@ return {

},
spacing.withWhiteSpace(),
spacing.withWhiteSpace()
);

@@ -39,0 +38,0 @@

@@ -5,3 +5,3 @@ import React from 'react';

import { select, text, withKnobs } from '@storybook/addon-knobs/react';
import { WithDocsCustom } from '@govuk-react/storybook-components';
import { withDocsCustom } from '@govuk-react/storybook-components';

@@ -17,10 +17,7 @@ import Heading from '@govuk-react/heading';

stories.addDecorator(withKnobs);
stories.addDecorator(WithDocsCustom(ReadMe));
stories.addDecorator(withDocsCustom(ReadMe));
examples.addDecorator(withKnobs);
stories.add('Component default', () => (
<CaptionWithKnobs />
));
stories.add('Component default', () => <CaptionWithKnobs />);
const arrTypography = Object.keys(TYPOGRAPHY_SCALE);

@@ -27,0 +24,0 @@ const captionOptions = [...Object.keys(CAPTION_SIZES), ...arrTypography];

@@ -7,5 +7,19 @@ import React from 'react';

describe('Caption', () => {
// Capture errors as we're expecting to throw some
// eslint-disable-next-line no-console
const nativeError = console.error;
beforeEach(() => {
jest.resetModules();
// eslint-disable-next-line no-console
console.error = () => {};
});
afterEach(() => {
// eslint-disable-next-line no-console
console.error = nativeError;
});
it('allows custom string-based font size without crashing', () => {
const sizes = ['XL', 'XLARGE', 'L', 'LARGE', 'M', 'MEDIUM'];
sizes.forEach((size) => {
sizes.forEach(size => {
expect(mount(<Caption size={size}>Tests</Caption>).exists()).toBeTruthy();

@@ -20,6 +34,14 @@ });

it('throws an error if an unsupported size is used', () => {
expect(() => { mount(<Caption size={0}>example</Caption>); }).toThrow();
expect(() => { mount(<Caption size={1}>example</Caption>); }).toThrow();
expect(() => { mount(<Caption size={99999}>example</Caption>); }).toThrow();
expect(() => { mount(<Caption size="test">example</Caption>); }).toThrow();
expect(() => {
mount(<Caption size={0}>example</Caption>);
}).toThrow();
expect(() => {
mount(<Caption size={1}>example</Caption>);
}).toThrow();
expect(() => {
mount(<Caption size={99999}>example</Caption>);
}).toThrow();
expect(() => {
mount(<Caption size="test">example</Caption>);
}).toThrow();
});

@@ -26,0 +48,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc