New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@khanacademy/wonder-blocks-form

Package Overview
Dependencies
Maintainers
1
Versions
612
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@khanacademy/wonder-blocks-form - npm Package Compare versions

Comparing version 2.2.3 to 2.3.0

5

dist/es/index.js

@@ -1054,3 +1054,4 @@ import _extends from '@babel/runtime/helpers/extends';

autoComplete,
forwardedRef
forwardedRef,
ariaDescribedby
} = this.props;

@@ -1066,3 +1067,3 @@ return /*#__PURE__*/createElement(IDProvider, {

id: `${uniqueId}-field`,
"aria-describedby": `${uniqueId}-error`,
"aria-describedby": ariaDescribedby ? ariaDescribedby : `${uniqueId}-error`,
"aria-invalid": this.state.error ? "true" : "false",

@@ -1069,0 +1070,0 @@ testId: testId && `${testId}-field`,

@@ -938,3 +938,4 @@ module.exports =

autoComplete,
forwardedRef
forwardedRef,
ariaDescribedby
} = this.props;

@@ -950,3 +951,3 @@ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_1__["IDProvider"], {

id: `${uniqueId}-field`,
"aria-describedby": `${uniqueId}-error`,
"aria-describedby": ariaDescribedby ? ariaDescribedby : `${uniqueId}-error`,
"aria-invalid": this.state.error ? "true" : "false",

@@ -953,0 +954,0 @@ testId: testId && `${testId}-field`,

4

package.json
{
"name": "@khanacademy/wonder-blocks-form",
"version": "2.2.3",
"version": "2.3.0",
"design": "v1",

@@ -34,3 +34,3 @@ "description": "Form components for Wonder Blocks.",

},
"gitHead": "b6193f70c73e70fbaf76bc688dc69a47fb1d0ef3"
"gitHead": "61090a61b6e9d2a735976d5fd53a15d06f10c853"
}
//@flow
import * as React from "react";
import {mount} from "enzyme";
import {render, screen} from "@testing-library/react";

@@ -189,2 +190,45 @@ import {StyleSheet} from "aphrodite";

it("ariaDescribedby prop sets aria-describedby", () => {
// Arrange
const ariaDescription = "aria description";
// Act
render(
<LabeledTextField
label="Label"
value=""
onChange={() => {}}
ariaDescribedby={ariaDescription}
/>,
);
// Assert
const input = screen.getByRole("textbox");
expect(input.getAttribute("aria-describedby")).toEqual(ariaDescription);
});
it("auto-generates a unique error when ariaDescribedby is not passed in", () => {
// Arrange
// Act
render(
<LabeledTextField
label="Label"
value=""
onChange={() => {}}
// ariaDescribedby is not passed in
/>,
);
// Assert
// Since the generated aria-describedby is unique,
// we cannot know what it will be.
// We only test if the aria-describedby attribute starts with
// "uid-" and ends with "-error".
const input = screen.getByRole("textbox");
expect(input.getAttribute("aria-describedby")).toMatch(
/^uid-.*-error$/,
);
});
it("validate prop is called when input changes", () => {

@@ -191,0 +235,0 @@ // Arrange

@@ -45,2 +45,7 @@ // @flow

/**
* Identifies the element or elements that describes this text field.
*/
ariaDescribedby?: string | Array<string>,
/**
* Provide a validation for the input value.

@@ -211,2 +216,3 @@ * Return a string error message or null | void for a valid input.

forwardedRef,
ariaDescribedby,
} = this.props;

@@ -224,3 +230,7 @@

id={`${uniqueId}-field`}
aria-describedby={`${uniqueId}-error`}
aria-describedby={
ariaDescribedby
? ariaDescribedby
: `${uniqueId}-error`
}
aria-invalid={

@@ -227,0 +237,0 @@ this.state.error ? "true" : "false"

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