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

@codecademy/brand-components

Package Overview
Dependencies
Maintainers
1
Versions
462
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@codecademy/brand-components - npm Package Compare versions

Comparing version 0.0.2-alpha.ecc983.1465 to 0.0.2-alpha.f38f53.1457

dist/brand-components/src/Quote/__tests__/Quote-test.d.ts

44

dist/Avatar/__tests__/avatar-test.js
import { mount } from 'enzyme';
import React from 'react';
import { VisualTheme } from '../../../../gamut/src/theming/VisualTheme';
import { Avatar } from '..';
import styles from '../../styles.module.scss';
describe('Avatar', function () {

@@ -10,11 +12,4 @@ it('when an "alt" prop is passed, an "alt" attribute is added to the <img/>', function () {

}));
expect(wrapper.find('img[alt="alt"]').length).toEqual(1);
expect(wrapper.find('img[alt="alt"]')).toHaveLength(1);
});
it('when an "alt" prop is passed, an "aria-labelledby" attribute cannot be added to the <img/>', function () {
var wrapper = mount(React.createElement(Avatar, {
src: "",
alt: "alt"
}));
expect(wrapper.find('img').prop('aria-labelledby')).toEqual(undefined);
});
it('when an "aria-labelledby" prop is passed, an "aria-labelledby" attribute is added to the <img/>', function () {

@@ -27,13 +22,30 @@ var wrapper = mount(React.createElement(React.Fragment, null, React.createElement(Avatar, {

}, "I is label")));
expect(wrapper.find('img[aria-labelledby="label"]').length).toEqual(1);
expect(wrapper.find('img[aria-labelledby="label"]')).toHaveLength(1);
});
it('when an "aria-labelledby" prop is passed, an "alt" attribute cannot be added to the <img/>', function () {
var wrapper = mount(React.createElement(React.Fragment, null, React.createElement(Avatar, {
it('adds the light class to the container name as a default', function () {
var wrapper = mount(React.createElement(Avatar, {
src: "",
"aria-labelledby": "label"
}), React.createElement("h1", {
id: "label"
}, "I is label")));
expect(wrapper.find('img').prop('alt')).toEqual(undefined);
alt: ""
}));
var containerClassName = wrapper.find("div").prop('className');
expect(containerClassName).toContain(styles.lightContainer);
});
it('adds the light class to the container name when its theme is light', function () {
var wrapper = mount(React.createElement(Avatar, {
src: "",
theme: VisualTheme.LightMode,
alt: ""
}));
var containerClassName = wrapper.find("div").prop('className');
expect(containerClassName).toContain(styles.lightContainer);
});
it('adds the dark class to the container name when its theme is dark', function () {
var wrapper = mount(React.createElement(Avatar, {
src: "",
theme: VisualTheme.DarkMode,
alt: ""
}));
var containerClassName = wrapper.find("div").prop('className');
expect(containerClassName).toContain(styles.darkContainer);
});
});

@@ -16,3 +16,3 @@ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

theme = _ref$theme === void 0 ? VisualTheme.LightMode : _ref$theme,
imageProps = _objectWithoutProperties(_ref, ["size", "theme"]);
avatarImageProps = _objectWithoutProperties(_ref, ["size", "theme"]);

@@ -23,10 +23,4 @@ return React.createElement("div", {

className: cx(s.image, s["".concat(size, "Image")])
}, imageProps)));
}, avatarImageProps)));
};
React.createElement(Avatar, {
src: "https://content.codecademy.com/courses/free/boba.svg",
alt: "testy",
size: 'regular',
theme: VisualTheme.LightMode
});
export default Avatar;
import React from 'react';
import { VisualTheme } from '../../../gamut/src/theming/VisualTheme';
declare type imageProps = {
declare type AvatarImageProps = {
alt: string;

@@ -10,3 +10,3 @@ 'aria-labelledby'?: never;

};
export declare type baseProps = {
export declare type AvatarBaseProps = {
src: string;

@@ -16,4 +16,4 @@ size?: 'regular' | 'large';

};
declare type AvatarProps = baseProps & imageProps;
declare type AvatarProps = AvatarBaseProps & AvatarImageProps;
export declare const Avatar: React.FC<AvatarProps>;
export default Avatar;
export { default as Avatar } from './Avatar';
export { default as Quote } from './Quote';

@@ -1,1 +0,2 @@

export { default as Avatar } from './Avatar';
export { default as Avatar } from './Avatar';
export { default as Quote } from './Quote';
{
"name": "@codecademy/brand-components",
"description": "Brand component library for Codecademy",
"version": "0.0.2-alpha.ecc983.1465+ecc983eb",
"version": "0.0.2-alpha.f38f53.1457+f38f5350",
"author": "Codecademy Engineering <dev@codecademy.com>",

@@ -21,3 +21,3 @@ "sideEffects": [

"dependencies": {
"@codecademy/gamut": "^2.4.8-alpha.ecc983.11+ecc983eb",
"@codecademy/gamut": "^2.4.7",
"@codecademy/gamut-styles": "^2.2.11",

@@ -35,6 +35,3 @@ "classnames": "^2.2.5"

"license": "MIT",
"devDependencies": {
"copyfiles": "^2.1.1"
},
"gitHead": "ecc983eb97f98bfe9da0a2266852fb73aaed8726"
"gitHead": "f38f535024e6590ff0d1fdb3c306eb5a817848cb"
}
export { default as Avatar } from './Avatar';
export { default as Quote } from './Quote';

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