Skip to content

Commit

Permalink
fix: test cases updated
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhadip committed Sep 11, 2022
1 parent 7597c58 commit c94197d
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 9 deletions.
4 changes: 2 additions & 2 deletions coverage/clover.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<coverage generated="1662867335730" clover="3.2.0">
<project timestamp="1662867335730" name="All files">
<coverage generated="1662908149967" clover="3.2.0">
<project timestamp="1662908149967" name="All files">
<metrics statements="51" coveredstatements="51" conditionals="47" coveredconditionals="42" methods="1" coveredmethods="1" elements="99" coveredelements="94" complexity="0" loc="51" ncloc="51" packages="1" files="1" classes="1"/>
<file name="Index.svelte" path="/Users/shubhadipmaity/projects/svelte-journey/svelte-otp/src/lib/Index.svelte">
<metrics statements="51" coveredstatements="51" conditionals="47" coveredconditionals="42" methods="1" coveredmethods="1"/>
Expand Down
2 changes: 1 addition & 1 deletion coverage/lcov-report/Index.svelte.html
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ <h1><a href="index.html">All files</a> Index.svelte</h1>
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2022-09-11T03:35:35.726Z
at 2022-09-11T14:55:49.961Z
</div>
<script src="prettify.js"></script>
<script>
Expand Down
2 changes: 1 addition & 1 deletion coverage/lcov-report/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ <h1>All files</h1>
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2022-09-11T03:35:35.726Z
at 2022-09-11T14:55:49.961Z
</div>
<script src="prettify.js"></script>
<script>
Expand Down
19 changes: 15 additions & 4 deletions src/__test__/otp.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,20 @@ test("Case 3: Otp Component Renders masked Inputs", () => {
maskInput: true,
});

screen.getAllByRole('input').forEach((o) => {
expect(o).toHaveAttribute('type', 'password');
});
/**
* need to find a better way
* getByRole doesn't work since type is password
*/

const input = screen.getByTestId('elem-0')
const input2 = screen.getByTestId('elem-1')
const input3 = screen.getByTestId('elem-2')
const input4 = screen.getByTestId('elem-3')

expect(input).toHaveAttribute("type","password")
expect(input2).toHaveAttribute("type","password")
expect(input3).toHaveAttribute("type","password")
expect(input4).toHaveAttribute("type","password")

});

Expand All @@ -63,7 +74,7 @@ test("Case 4: Otp Component Renders With Initial Value", () => {
/**
* need to find a better way
*/
screen.getAllByRole('input').forEach((o, index) => {
screen.getAllByRole('textbox').forEach((o, index) => {
const shouldHaveValue = prefillValue[index]
expect(o).toHaveValue(shouldHaveValue)
})
Expand Down
2 changes: 1 addition & 1 deletion src/lib/TextInput/Index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

<div class={`${customInputWrapperClass} textcontainer`}>
<input
role="input"
name="input"
type={inputType}
{placeholder}
{value}
Expand Down

0 comments on commit c94197d

Please sign in to comment.