playbook_ui 13.13.0.pre.alpha.play900startratingasinput1657 → 13.13.0.pre.alpha.play10221678

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +3 -0
  3. data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +3 -0
  4. data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +11 -10
  5. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_custom.html.erb +29 -0
  6. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_custom.jsx +34 -0
  7. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_custom.md +7 -0
  8. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_custom_override.html.erb +28 -0
  9. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_custom_override.jsx +34 -0
  10. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_custom_override.md +1 -0
  11. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_react.jsx +2 -2
  12. data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +4 -0
  13. data/app/pb_kits/playbook/pb_date_picker/docs/index.js +2 -0
  14. data/app/pb_kits/playbook/pb_date_picker/plugins/quickPick.tsx +69 -3
  15. data/app/pb_kits/playbook/pb_star_rating/_star_rating.scss +53 -105
  16. data/app/pb_kits/playbook/pb_star_rating/_star_rating.tsx +62 -179
  17. data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_default.html.erb +8 -6
  18. data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_default.jsx +6 -19
  19. data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_hide.html.erb +1 -3
  20. data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_hide.jsx +5 -22
  21. data/app/pb_kits/playbook/pb_star_rating/docs/example.yml +5 -12
  22. data/app/pb_kits/playbook/pb_star_rating/docs/index.js +0 -8
  23. data/app/pb_kits/playbook/pb_star_rating/star_rating.html.erb +26 -48
  24. data/app/pb_kits/playbook/pb_star_rating/star_rating.rb +6 -82
  25. data/app/pb_kits/playbook/pb_star_rating/star_rating.test.js +34 -34
  26. data/dist/playbook-rails.js +5 -5
  27. data/lib/playbook/version.rb +1 -1
  28. metadata +8 -15
  29. data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_background_options.html.erb +0 -2
  30. data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_background_options.jsx +0 -25
  31. data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_color_options.html.erb +0 -3
  32. data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_color_options.jsx +0 -31
  33. data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_number_config.html.erb +0 -6
  34. data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_number_config.jsx +0 -58
  35. data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_size_options.html.erb +0 -16
  36. data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_size_options.jsx +0 -60
  37. data/app/pb_kits/playbook/pb_star_rating/stars/primary_star.svg +0 -3
  38. data/app/pb_kits/playbook/pb_star_rating/stars/star_outline.svg +0 -3
  39. data/app/pb_kits/playbook/pb_star_rating/stars/subtle_dark_star.svg +0 -3
  40. data/app/pb_kits/playbook/pb_star_rating/stars/subtle_star.svg +0 -3
  41. 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 correct denominator", () => {
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
- expect(count).toBe(4)
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
- test("Uses correct size", () => {
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
- layoutOption="number"
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(".star_flex_area")
64
- const title = kit.querySelector(".pb_star_rating_number_lg")
65
- const stars = highlight.querySelectorAll(".pb_star_lg")
66
- const count = stars.length
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(title.className).toBe("pb_title_kit_size_2 pr_sm pb_star_rating_number_lg")
69
- expect(count).toBe(5)
70
- })
71
- })
68
+ expect(starCount).toBe(3);
69
+ expect(halfStarCount).toBe(1);
70
+ });
71
+ });