-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(carbon-provider): add deprecation warning for roundedCornersOptO…
…ut & focusRedesignOptOut deprecates both feature flags and each respective flags previous styling
- Loading branch information
1 parent
03a9f36
commit 99410b5
Showing
3 changed files
with
78 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import React from "react"; | ||
import { render } from "@testing-library/react"; | ||
import CarbonProvider from "."; | ||
import Logger from "../../__internal__/utils/logger"; | ||
|
||
test("logs a deprecation warning once when the `roundedCornersOptOut` feature flag is `true`", () => { | ||
const loggerSpy = jest | ||
.spyOn(Logger, "deprecate") | ||
.mockImplementation(() => {}); | ||
|
||
render( | ||
<> | ||
<CarbonProvider roundedCornersOptOut> | ||
<CarbonProvider>Hello World!</CarbonProvider> | ||
</CarbonProvider> | ||
<CarbonProvider roundedCornersOptOut> | ||
<CarbonProvider>Hello World!</CarbonProvider> | ||
</CarbonProvider> | ||
</>, | ||
); | ||
|
||
expect(loggerSpy).toHaveBeenCalledWith( | ||
"The `roundedCornersOptOut` feature flag has been deprecated and will soon be removed. " + | ||
"Along with this feature flag, the legacy pre-rounded corners styling will also be removed. ", | ||
); | ||
expect(loggerSpy).toHaveBeenCalledTimes(1); | ||
loggerSpy.mockRestore(); | ||
}); | ||
|
||
test("logs a deprecation warning once when the `focusRedesignOptOut` feature flag is `true`", () => { | ||
const loggerSpy = jest | ||
.spyOn(Logger, "deprecate") | ||
.mockImplementation(() => {}); | ||
|
||
render( | ||
<> | ||
<CarbonProvider focusRedesignOptOut> | ||
<CarbonProvider>Hello World!</CarbonProvider> | ||
</CarbonProvider> | ||
<CarbonProvider focusRedesignOptOut> | ||
<CarbonProvider>Hello World!</CarbonProvider> | ||
</CarbonProvider> | ||
</>, | ||
); | ||
|
||
expect(loggerSpy).toHaveBeenCalledWith( | ||
"The `focusRedesignOptOut` feature flag has been deprecated and will soon be removed. " + | ||
"Along with this feature flag, the legacy focus styling will also be removed. ", | ||
); | ||
expect(loggerSpy).toHaveBeenCalledTimes(1); | ||
loggerSpy.mockRestore(); | ||
}); |