forked from Hacker0x01/react-datepicker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds title attribute to clear button (Hacker0x01#1317)
* Adds title attribute to clear button * Changes title attribute to be configurable, adds test, updates docs * Updates clear button to be a button and removes it from tab order
- Loading branch information
1 parent
5eee56f
commit 988c28d
Showing
4 changed files
with
33 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,31 @@ | ||
import React from "react"; | ||
import WeekNumber from "../src/week_number"; | ||
import { shallow } from "enzyme"; | ||
import sinon from "sinon"; | ||
|
||
function renderWeekNumber(weekNumber, props = {}) { | ||
return shallow(<WeekNumber weekNumber={weekNumber} {...props} />); | ||
} | ||
|
||
describe("WeekNumber", () => { | ||
let shallowWeekNumber; | ||
describe("rendering", () => { | ||
it("should render the specified Week Number", () => { | ||
const weekNumber = 1; | ||
const shallowWeekNumber = renderWeekNumber(weekNumber); | ||
shallowWeekNumber = renderWeekNumber(weekNumber); | ||
expect( | ||
shallowWeekNumber.hasClass("react-datepicker__week-number") | ||
).to.equal(true); | ||
expect(shallowWeekNumber.text()).to.equal(weekNumber + ""); | ||
}); | ||
|
||
it("should call the onClick function if it is defined", () => { | ||
const onClick = sinon.spy(); | ||
shallowWeekNumber = shallow( | ||
<WeekNumber weekNumber={1} onClick={onClick} /> | ||
); | ||
shallowWeekNumber.instance().handleClick({}); | ||
expect(onClick).to.have.property("callCount", 1); | ||
}); | ||
}); | ||
}); |