File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import React from "react" ;
2+ import { render } from "@testing-library/react" ;
3+ import { SubmitButton } from "./submit-button" ;
4+ import faker from "faker" ;
5+ import { ButtonStyles } from "../constants/button-styles" ;
26
37describe ( "SubmitButton" , ( ) => {
4- test . skip ( "TODO - https://github.com/AndcultureCode/AndcultureCode.JavaScript.React.Components/issues/8" , ( ) => { } ) ;
8+ test ( "when default props, renders default buttonText" , async ( ) => {
9+ // Arrange
10+ const expected = "Submit" ;
11+
12+ // Act
13+ const { getByText } = render ( < SubmitButton /> ) ;
14+
15+ // Assert
16+ expect ( getByText ( expected ) ) . not . toBeNull ( ) ;
17+ } ) ;
18+ test ( "when buttonText provided, renders supplied buttonText" , async ( ) => {
19+ // Arrange
20+ const expected = faker . random . words ( ) ;
21+
22+ // Act
23+ const { getByText } = render ( < SubmitButton buttonText = { expected } /> ) ;
24+
25+ // Assert
26+ expect ( getByText ( expected ) ) . not . toBeNull ( ) ;
27+ } ) ;
28+
29+ test ( "when cssClassName provided, renders with className set" , async ( ) => {
30+ // Arrange
31+ const expected = ButtonStyles . Anchor ;
32+
33+ // Act
34+ const { container } = render ( < SubmitButton cssClassName = { expected } /> ) ;
35+
36+ // Assert
37+ expect ( container . firstChild . className ) . toContain ( expected ) ;
38+ } ) ;
539} ) ;
You can’t perform that action at this time.
0 commit comments