playbook_ui 13.13.0.pre.alpha.play900startratingasinput1657 → 13.13.0.pre.alpha.play10221678
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +3 -0
- data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +3 -0
- data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +11 -10
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_custom.html.erb +29 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_custom.jsx +34 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_custom.md +7 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_custom_override.html.erb +28 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_custom_override.jsx +34 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_custom_override.md +1 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_react.jsx +2 -2
- data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +4 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_date_picker/plugins/quickPick.tsx +69 -3
- data/app/pb_kits/playbook/pb_star_rating/_star_rating.scss +53 -105
- data/app/pb_kits/playbook/pb_star_rating/_star_rating.tsx +62 -179
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_default.html.erb +8 -6
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_default.jsx +6 -19
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_hide.html.erb +1 -3
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_hide.jsx +5 -22
- data/app/pb_kits/playbook/pb_star_rating/docs/example.yml +5 -12
- data/app/pb_kits/playbook/pb_star_rating/docs/index.js +0 -8
- data/app/pb_kits/playbook/pb_star_rating/star_rating.html.erb +26 -48
- data/app/pb_kits/playbook/pb_star_rating/star_rating.rb +6 -82
- data/app/pb_kits/playbook/pb_star_rating/star_rating.test.js +34 -34
- data/dist/playbook-rails.js +5 -5
- data/lib/playbook/version.rb +1 -1
- metadata +8 -15
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_background_options.html.erb +0 -2
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_background_options.jsx +0 -25
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_color_options.html.erb +0 -3
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_color_options.jsx +0 -31
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_number_config.html.erb +0 -6
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_number_config.jsx +0 -58
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_size_options.html.erb +0 -16
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_size_options.jsx +0 -60
- data/app/pb_kits/playbook/pb_star_rating/stars/primary_star.svg +0 -3
- data/app/pb_kits/playbook/pb_star_rating/stars/star_outline.svg +0 -3
- data/app/pb_kits/playbook/pb_star_rating/stars/subtle_dark_star.svg +0 -3
- data/app/pb_kits/playbook/pb_star_rating/stars/subtle_star.svg +0 -3
- data/app/pb_kits/playbook/pb_star_rating/stars/yellow_star.svg +0 -3
@@ -1,22 +1,24 @@
|
|
1
|
-
import React from "react"
|
2
|
-
import { render, screen } from "../utilities/test-utils"
|
1
|
+
import React from "react";
|
2
|
+
import { render, screen } from "../utilities/test-utils";
|
3
3
|
|
4
|
-
import StarRating from "./_star_rating"
|
4
|
+
import StarRating from "./_star_rating";
|
5
5
|
|
6
|
-
const testId = "star-rating-kit"
|
6
|
+
const testId = "star-rating-kit";
|
7
7
|
|
8
8
|
describe("Star Rating Kit", () => {
|
9
9
|
test("Expects to have correct classname", () => {
|
10
10
|
render(
|
11
11
|
<StarRating
|
12
12
|
data={{ testid: testId }}
|
13
|
+
rating={2}
|
13
14
|
/>
|
14
|
-
)
|
15
|
+
);
|
15
16
|
|
16
|
-
const kit = screen.getByTestId(testId)
|
17
|
-
expect(kit.className).toBe("pb_star_rating_kit")
|
18
17
|
|
19
|
-
|
18
|
+
const kit = screen.getByTestId(testId);
|
19
|
+
expect(kit).toHaveClass("pb_star_rating_kit");
|
20
|
+
|
21
|
+
});
|
20
22
|
|
21
23
|
test('should render aria-label', () => {
|
22
24
|
render(
|
@@ -25,47 +27,45 @@ describe("Star Rating Kit", () => {
|
|
25
27
|
data={{ testid: testId }}
|
26
28
|
rating={2}
|
27
29
|
/>
|
28
|
-
)
|
30
|
+
);
|
29
31
|
|
30
32
|
const kit = screen.getByTestId(testId)
|
31
33
|
expect(kit).toHaveAttribute('aria-label', testId)
|
32
|
-
})
|
34
|
+
});
|
33
35
|
|
34
|
-
test("Displays
|
36
|
+
test("Displays two highlighted stars", () => {
|
35
37
|
render(
|
36
38
|
<StarRating
|
37
39
|
data={{ testid: testId }}
|
38
|
-
denominator={4}
|
39
40
|
rating={2}
|
40
|
-
size="xs"
|
41
41
|
/>
|
42
|
-
)
|
42
|
+
);
|
43
43
|
|
44
|
-
const kit = screen.getByTestId(testId)
|
45
|
-
const highlight = kit.querySelector(".star_flex_area")
|
46
|
-
const stars = highlight.querySelectorAll(".pb_star_xs")
|
47
|
-
const count = stars.length
|
48
44
|
|
49
|
-
|
50
|
-
|
45
|
+
const kit = screen.getByTestId(testId);
|
46
|
+
const highlight = kit.querySelector(".pb_star_rating_highlight");
|
47
|
+
const stars = highlight.querySelectorAll(".far.fa-star");
|
48
|
+
const count = stars.length;
|
51
49
|
|
52
|
-
|
50
|
+
expect(count).toBe(2);
|
51
|
+
});
|
52
|
+
|
53
|
+
test("Displays three highlighted stars and a half star", () => {
|
53
54
|
render(
|
54
55
|
<StarRating
|
55
56
|
data={{ testid: testId }}
|
56
|
-
|
57
|
-
rating={2}
|
58
|
-
size="lg"
|
57
|
+
rating={3.5}
|
59
58
|
/>
|
60
|
-
)
|
59
|
+
);
|
61
60
|
|
62
|
-
const kit = screen.getByTestId(testId)
|
63
|
-
const highlight = kit.querySelector(".
|
64
|
-
const
|
65
|
-
const
|
66
|
-
const
|
61
|
+
const kit = screen.getByTestId(testId);
|
62
|
+
const highlight = kit.querySelector(".pb_star_rating_highlight");
|
63
|
+
const stars = highlight.querySelectorAll(".far.fa-star");
|
64
|
+
const halfStars = highlight.querySelectorAll(".far.fa-star-half");
|
65
|
+
const starCount = stars.length;
|
66
|
+
const halfStarCount = halfStars.length;
|
67
67
|
|
68
|
-
expect(
|
69
|
-
expect(
|
70
|
-
})
|
71
|
-
})
|
68
|
+
expect(starCount).toBe(3);
|
69
|
+
expect(halfStarCount).toBe(1);
|
70
|
+
});
|
71
|
+
});
|