Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add trigger specification cache to Htmxor #44

Merged
merged 18 commits into from
May 13, 2024

fix: simplified creating trigger spec dictionary using collection exp…

3710af2
Select commit
Loading
Failed to load commit list.
Sign in for the full log view
Merged

feat: Add trigger specification cache to Htmxor #44

fix: simplified creating trigger spec dictionary using collection exp…
3710af2
Select commit
Loading
Failed to load commit list.
GitHub Actions / test-results succeeded May 13, 2024 in 1s

152 passed, 0 failed and 0 skipped

Tests passed successfully

✅ /home/runner/work/Htmxor/Htmxor/TestResults/_fv-az659-258_2024-05-13_23_42_46.trx

152 tests were completed in 8s with 152 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
Htmxor.Builder.HtmxorComponentEndpointDataSourceTest 1✅ 253ms
Htmxor.Builder.HtmxorComponentEndpointMatcherPolicyTest 22✅ 424ms
Htmxor.Configuration.HtmxHeadOutletTest 6✅ 2s
Htmxor.DemoTestCases.BulkUpdate1Test 1✅ 735ms
Htmxor.DemoTestCases.ClickToEdit1Test 5✅ 4s
Htmxor.DemoTestCases.DeleteRowTest 1✅ 505ms
Htmxor.DemoTestCases.HxValsTest 1✅ 265ms
Htmxor.E2E.ClickToEditE2ETests 1✅ 357ms
Htmxor.E2E.EventHandlerE2ETest 1✅ 472ms
Htmxor.EventHandlerTest 7✅ 5s
Htmxor.HtmxorComponentRequestHostTest 42✅ 21s
Htmxor.Http.HtmxResponseTests 26✅ 597ms
Htmxor.RequestRoutingTest 2✅ 1s
Htmxor.SwapStyleBuilderTests 18✅ 41ms
Htmxor.TriggerBuilderTests 18✅ 147ms

✅ Htmxor.Builder.HtmxorComponentEndpointDataSourceTest

✅ Registers_endpoints_based_on_HxRoute

✅ Htmxor.Builder.HtmxorComponentEndpointMatcherPolicyTest

✅ AppliesToEndpoints_with_hxroute_endpoint
✅ AppliesToEndpoints_with_route_only_endpoint
✅ ApplyAsync_HxRequest_HxEndpoint
✅ ApplyAsync_HxRequest_HxEndpoint_matching(hxRouteAttribute: HtmxRouteAttribute { CurrentURL = "/foo", Methods = ["GET", "POST", "PUT", "PATCH", "DELETE"], Target = null, Targets = [], Template = "/", ··· }, requestHeaders: [Tuple ("HX-Current-URL", "/foo")])
✅ ApplyAsync_HxRequest_HxEndpoint_matching(hxRouteAttribute: HtmxRouteAttribute { CurrentURL = "/foo", Methods = ["GET", "POST", "PUT", "PATCH", "DELETE"], Target = null, Targets = [], Template = "/", ··· }, requestHeaders: [Tuple ("HX-Current-URL", "/FOO")])
✅ ApplyAsync_HxRequest_HxEndpoint_matching(hxRouteAttribute: HtmxRouteAttribute { CurrentURL = "/FOO", Methods = ["GET", "POST", "PUT", "PATCH", "DELETE"], Target = null, Targets = [], Template = "/", ··· }, requestHeaders: [Tuple ("HX-Current-URL", "/foo")])
✅ ApplyAsync_HxRequest_HxEndpoint_matching(hxRouteAttribute: HtmxRouteAttribute { CurrentURL = null, Methods = ["GET", "POST", "PUT", "PATCH", "DELETE"], Target = "#foo", Targets = [], Template = "/", ··· }, requestHeaders: [Tuple ("HX-Target", "#foo")])
✅ ApplyAsync_HxRequest_HxEndpoint_matching(hxRouteAttribute: HtmxRouteAttribute { CurrentURL = null, Methods = ["GET", "POST", "PUT", "PATCH", "DELETE"], Target = "#foo", Targets = [], Template = "/", ··· }, requestHeaders: [Tuple ("HX-Target", "#FOO")])
✅ ApplyAsync_HxRequest_HxEndpoint_matching(hxRouteAttribute: HtmxRouteAttribute { CurrentURL = null, Methods = ["GET", "POST", "PUT", "PATCH", "DELETE"], Target = null, Targets = ["#foo", "#bar"], Template = "/", ··· }, requestHeaders: [Tuple ("HX-Target", "#BAR")])
✅ ApplyAsync_HxRequest_HxEndpoint_matching(hxRouteAttribute: HtmxRouteAttribute { CurrentURL = null, Methods = ["GET", "POST", "PUT", "PATCH", "DELETE"], Target = null, Targets = ["#foo", "#bar"], Template = "/", ··· }, requestHeaders: [Tuple ("HX-Target", "#foo")])
✅ ApplyAsync_HxRequest_HxEndpoint_matching(hxRouteAttribute: HtmxRouteAttribute { CurrentURL = null, Methods = ["GET", "POST", "PUT", "PATCH", "DELETE"], Target = null, Targets = [], Template = "/", ··· }, requestHeaders: [])
✅ ApplyAsync_HxRequest_HxEndpoint_matching(hxRouteAttribute: HtmxRouteAttribute { CurrentURL = null, Methods = ["GET", "POST", "PUT", "PATCH", "DELETE"], Target = null, Targets = [], Template = "/", ··· }, requestHeaders: [Tuple ("HX-Trigger-Name", "#foo")])
✅ ApplyAsync_HxRequest_HxEndpoint_matching(hxRouteAttribute: HtmxRouteAttribute { CurrentURL = null, Methods = ["GET", "POST", "PUT", "PATCH", "DELETE"], Target = null, Targets = [], Template = "/", ··· }, requestHeaders: [Tuple ("HX-Trigger-Name", "#FOO")])
✅ ApplyAsync_HxRequest_HxEndpoint_matching(hxRouteAttribute: HtmxRouteAttribute { CurrentURL = null, Methods = ["GET", "POST", "PUT", "PATCH", "DELETE"], Target = null, Targets = [], Template = "/", ··· }, requestHeaders: [Tuple ("HX-Trigger", "#foo")])
✅ ApplyAsync_HxRequest_HxEndpoint_matching(hxRouteAttribute: HtmxRouteAttribute { CurrentURL = null, Methods = ["GET", "POST", "PUT", "PATCH", "DELETE"], Target = null, Targets = [], Template = "/", ··· }, requestHeaders: [Tuple ("HX-Trigger", "#FOO")])
✅ ApplyAsync_HxRequest_HxEndpoint_none_matching(hxRouteAttribute: HtmxRouteAttribute { CurrentURL = "/foo", Methods = ["GET", "POST", "PUT", "PATCH", "DELETE"], Target = null, Targets = [], Template = "/", ··· }, requestHeaders: [Tuple ("HX-Current-URL", "/bar")])
✅ ApplyAsync_HxRequest_HxEndpoint_none_matching(hxRouteAttribute: HtmxRouteAttribute { CurrentURL = null, Methods = ["GET", "POST", "PUT", "PATCH", "DELETE"], Target = "#foo", Targets = [], Template = "/", ··· }, requestHeaders: [Tuple ("HX-Target", "#bar")])
✅ ApplyAsync_HxRequest_HxEndpoint_none_matching(hxRouteAttribute: HtmxRouteAttribute { CurrentURL = null, Methods = ["GET", "POST", "PUT", "PATCH", "DELETE"], Target = null, Targets = ["#foo", "#bar"], Template = "/", ··· }, requestHeaders: [Tuple ("HX-Target", "#baz")])
✅ ApplyAsync_HxRequest_HxEndpoint_none_matching(hxRouteAttribute: HtmxRouteAttribute { CurrentURL = null, Methods = ["GET", "POST", "PUT", "PATCH", "DELETE"], Target = null, Targets = [], Template = "/", ··· }, requestHeaders: [Tuple ("HX-Trigger-Name", "#bar")])
✅ ApplyAsync_HxRequest_HxEndpoint_none_matching(hxRouteAttribute: HtmxRouteAttribute { CurrentURL = null, Methods = ["GET", "POST", "PUT", "PATCH", "DELETE"], Target = null, Targets = [], Template = "/", ··· }, requestHeaders: [Tuple ("HX-Trigger", "#bar")])
✅ ApplyAsync_HxRequest_RouteEndpoint
✅ ApplyAsync_RouteRequest_HxEndpoint

✅ Htmxor.Configuration.HtmxHeadOutletTest

✅ HtmxConfig_default_swap_style_serializer
✅ HtmxConfig_serializer
✅ TriggerSpecificationCache_ComplexTriggers_ReturnsCorrectJson
✅ TriggerSpecificationCache_EveryAndOnEvent_ReturnsCorrectJson
✅ TriggerSpecificationCache_OnEventWithFrom_ReturnsCorrectJson
✅ TriggerSpecificationCache_Revealed_ReturnsCorrectJson

✅ Htmxor.DemoTestCases.BulkUpdate1Test

✅ Hx_post_with_partial_return

✅ Htmxor.DemoTestCases.ClickToEdit1Test

✅ Hx_get_edit
✅ Hx_get_view
✅ Hx_put_view
✅ None_hx_get_edit
✅ None_hx_get_view

✅ Htmxor.DemoTestCases.DeleteRowTest

✅ Hx_delete_returns_204_without_content

✅ Htmxor.DemoTestCases.HxValsTest

✅ HxVals_correctly_escaped_by_renderer

✅ Htmxor.E2E.ClickToEditE2ETests

✅ Click_to_edit

✅ Htmxor.E2E.EventHandlerE2ETest

✅ Invoke_event_handler_methods

✅ Htmxor.EventHandlerTest

✅ Delete_method_htmxor_event_handler
✅ Get_lambda_htmxor_event_handler
✅ Get_method_htmxor_event_handler
✅ Patch_method_htmxor_event_handler
✅ Post_method_htmxor_event_handler
✅ Put_method_htmxor_event_handler
✅ Submit_form_htmxor_event_handler

✅ Htmxor.HtmxorComponentRequestHostTest

✅ Route_values_in_component<Boolean>(isHtmxRequest: False, id: "boolValue", value: False)
✅ Route_values_in_component<Boolean>(isHtmxRequest: False, id: "boolValue", value: True)
✅ Route_values_in_component<Boolean>(isHtmxRequest: True, id: "boolValue", value: False)
✅ Route_values_in_component<Boolean>(isHtmxRequest: True, id: "boolValue", value: True)
✅ Route_values_in_component<Double>(isHtmxRequest: False, id: "doubleValue", value: -1.7976931348623157E+308)
✅ Route_values_in_component<Double>(isHtmxRequest: False, id: "doubleValue", value: 1.7976931348623157E+308)
✅ Route_values_in_component<Double>(isHtmxRequest: False, id: "doubleValue", value: 2.7182818284590451)
✅ Route_values_in_component<Double>(isHtmxRequest: True, id: "doubleValue", value: -1.7976931348623157E+308)
✅ Route_values_in_component<Double>(isHtmxRequest: True, id: "doubleValue", value: 1.7976931348623157E+308)
✅ Route_values_in_component<Double>(isHtmxRequest: True, id: "doubleValue", value: 2.7182818284590451)
✅ Route_values_in_component<Int32>(isHtmxRequest: False, id: "intValue", value: -2147483648)
✅ Route_values_in_component<Int32>(isHtmxRequest: False, id: "intValue", value: 2147483647)
✅ Route_values_in_component<Int32>(isHtmxRequest: False, id: "intValue", value: 42)
✅ Route_values_in_component<Int32>(isHtmxRequest: True, id: "intValue", value: -2147483648)
✅ Route_values_in_component<Int32>(isHtmxRequest: True, id: "intValue", value: 2147483647)
✅ Route_values_in_component<Int32>(isHtmxRequest: True, id: "intValue", value: 42)
✅ Route_values_in_component<Int64>(isHtmxRequest: False, id: "longValue", value: -9223372036854775808)
✅ Route_values_in_component<Int64>(isHtmxRequest: False, id: "longValue", value: 72036854775807)
✅ Route_values_in_component<Int64>(isHtmxRequest: False, id: "longValue", value: 9223372036854775807)
✅ Route_values_in_component<Int64>(isHtmxRequest: True, id: "longValue", value: -9223372036854775808)
✅ Route_values_in_component<Int64>(isHtmxRequest: True, id: "longValue", value: 72036854775807)
✅ Route_values_in_component<Int64>(isHtmxRequest: True, id: "longValue", value: 9223372036854775807)
✅ Route_values_in_component<Single>(isHtmxRequest: False, id: "floatValue", value: -3.40282347E+38)
✅ Route_values_in_component<Single>(isHtmxRequest: False, id: "floatValue", value: 1.40129846E-45)
✅ Route_values_in_component<Single>(isHtmxRequest: False, id: "floatValue", value: 3.40282347E+38)
✅ Route_values_in_component<Single>(isHtmxRequest: True, id: "floatValue", value: -3.40282347E+38)
✅ Route_values_in_component<Single>(isHtmxRequest: True, id: "floatValue", value: 1.40129846E-45)
✅ Route_values_in_component<Single>(isHtmxRequest: True, id: "floatValue", value: 3.40282347E+38)
✅ Route_values_in_component<String>(isHtmxRequest: False, id: "datetimeValue", value: "2024-05-03T09:07:54.5004759+00:00")
✅ Route_values_in_component<String>(isHtmxRequest: False, id: "decimalValue", value: "-79228162514264337593543950335")
✅ Route_values_in_component<String>(isHtmxRequest: False, id: "decimalValue", value: "123.45")
✅ Route_values_in_component<String>(isHtmxRequest: False, id: "decimalValue", value: "79228162514264337593543950335")
✅ Route_values_in_component<String>(isHtmxRequest: False, id: "guidValue", value: "00000000-0000-0000-0000-000000000000")
✅ Route_values_in_component<String>(isHtmxRequest: False, id: "guidValue", value: "e46fb987-6eac-4a1d-9744-ec68878a7a2e")
✅ Route_values_in_component<String>(isHtmxRequest: False, id: "stringValue", value: "foo-bar")
✅ Route_values_in_component<String>(isHtmxRequest: True, id: "datetimeValue", value: "2024-05-03T09:07:54.5004759+00:00")
✅ Route_values_in_component<String>(isHtmxRequest: True, id: "decimalValue", value: "-79228162514264337593543950335")
✅ Route_values_in_component<String>(isHtmxRequest: True, id: "decimalValue", value: "123.45")
✅ Route_values_in_component<String>(isHtmxRequest: True, id: "decimalValue", value: "79228162514264337593543950335")
✅ Route_values_in_component<String>(isHtmxRequest: True, id: "guidValue", value: "00000000-0000-0000-0000-000000000000")
✅ Route_values_in_component<String>(isHtmxRequest: True, id: "guidValue", value: "e46fb987-6eac-4a1d-9744-ec68878a7a2e")
✅ Route_values_in_component<String>(isHtmxRequest: True, id: "stringValue", value: "foo-bar")

✅ Htmxor.Http.HtmxResponseTests

✅ Location_AddsLocationHeader
✅ Location_AddsLocationWIthAjaxContextHeader
✅ Multiple_trigger_events_without_details(triggerTiming: AfterSettle, expectedHeaderKey: "HX-Trigger-After-Settle")
✅ Multiple_trigger_events_without_details(triggerTiming: AfterSwap, expectedHeaderKey: "HX-Trigger-After-Swap")
✅ Multiple_trigger_events_without_details(triggerTiming: Default, expectedHeaderKey: "HX-Trigger")
✅ PushUrl_AddsPushUrlBrowserHistoryHeader
✅ PushUrl_AddsPushUrlHeader
✅ Redirect_AddsRedirectHeader
✅ Refresh_AddsRefreshHeader
✅ ReplaceUrl_AddsReplaceUrlBrowserCUrrentUrlHeader
✅ ReplaceUrl_AddsReplaceUrlHeader
✅ Reselect_AddsReselectHeader
✅ Reswap_AddsReswapHeader
✅ Retarget_AddsRetargetHeader
✅ Same_trigger_event_twice_without_details(triggerTiming: AfterSettle, expectedHeaderKey: "HX-Trigger-After-Settle")
✅ Same_trigger_event_twice_without_details(triggerTiming: AfterSwap, expectedHeaderKey: "HX-Trigger-After-Swap")
✅ Same_trigger_event_twice_without_details(triggerTiming: Default, expectedHeaderKey: "HX-Trigger")
✅ Trigger_CanUseExistingTriggerWithMultipleTriggersWithDetail_AddsCorrectTriggerHeader(triggerTiming: AfterSettle, expectedHeaderKey: "HX-Trigger-After-Settle")
✅ Trigger_CanUseExistingTriggerWithMultipleTriggersWithDetail_AddsCorrectTriggerHeader(triggerTiming: AfterSwap, expectedHeaderKey: "HX-Trigger-After-Swap")
✅ Trigger_CanUseExistingTriggerWithMultipleTriggersWithDetail_AddsCorrectTriggerHeader(triggerTiming: Default, expectedHeaderKey: "HX-Trigger")
✅ Trigger_DefaultObject_AddsTriggerHeaderWithJsonString(triggerTiming: AfterSettle, expectedHeaderKey: "HX-Trigger-After-Settle")
✅ Trigger_DefaultObject_AddsTriggerHeaderWithJsonString(triggerTiming: AfterSwap, expectedHeaderKey: "HX-Trigger-After-Swap")
✅ Trigger_DefaultObject_AddsTriggerHeaderWithJsonString(triggerTiming: Default, expectedHeaderKey: "HX-Trigger")
✅ Trigger_without_details(triggerTiming: AfterSettle, expectedHeaderKey: "HX-Trigger-After-Settle")
✅ Trigger_without_details(triggerTiming: AfterSwap, expectedHeaderKey: "HX-Trigger-After-Swap")
✅ Trigger_without_details(triggerTiming: Default, expectedHeaderKey: "HX-Trigger")

✅ Htmxor.RequestRoutingTest

✅ HxRequest
✅ NormalRequest

✅ Htmxor.SwapStyleBuilderTests

✅ SwapStyleBuilder_After_With250Milliseconds_AddsCorrectDelay
✅ SwapStyleBuilder_AfterSettle_AddsCorrectDelay
✅ SwapStyleBuilder_AfterSwap_AddsCorrectDelay
✅ SwapStyleBuilder_ChainedOperations_AddsCorrectModifiers
✅ SwapStyleBuilder_IgnoreTitle_AddsCorrectFlag
✅ SwapStyleBuilder_InitializeAndBuild_ReturnsCorrectValues
✅ SwapStyleBuilder_MixedShowOverrides_ReturnsCorrectValue
✅ SwapStyleBuilder_NullSwapStyle_ReturnsNullStyle
✅ SwapStyleBuilder_Scroll_AddsCorrectDirection
✅ SwapStyleBuilder_ScrollFocus_AddsCorrectFlag
✅ SwapStyleBuilder_ShowNone_ReturnsCorrectValue
✅ SwapStyleBuilder_ShowOn_AddsCorrectSelectorAndDirection
✅ SwapStyleBuilder_ShowOn_BottomDirection_AddsCorrectModifier
✅ SwapStyleBuilder_ShowOnBottom_ReturnsCorrectValue
✅ SwapStyleBuilder_ShowOnTop_ReturnsCorrectValue
✅ SwapStyleBuilder_ShowWindow_AddsCorrectWindowAndDirection
✅ SwapStyleBuilder_ShowWindow_BottomDirection_AddsCorrectModifier
✅ SwapStyleBuilder_Transition_AddsCorrectFlag

✅ Htmxor.TriggerBuilderTests

✅ TriggerBuilder_ChainedOperations_AddsCorrectModifiers
✅ TriggerBuilder_Custom_CreatesCorrectTrigger
✅ TriggerBuilder_Every_CreatesCorrectTrigger
✅ TriggerBuilder_Intersect_CreatesCorrectTrigger
✅ TriggerBuilder_Load_CreatesCorrectTrigger
✅ TriggerBuilder_MultipleTriggers_AddsCorrectModifiers
✅ TriggerBuilder_OnEvent_CreatesCorrectTrigger
✅ TriggerBuilder_Revealed_CreatesCorrectTrigger
✅ TriggerBuilder_Sse_CreatesCorrectTrigger
✅ TriggerModifierBuilder_Changed_AddsChangedModifier
✅ TriggerModifierBuilder_Consume_AddsConsumeModifier
✅ TriggerModifierBuilder_Delay_AddsDelayModifier
✅ TriggerModifierBuilder_From_AddsFromModifier
✅ TriggerModifierBuilder_Once_AddsOnceModifier
✅ TriggerModifierBuilder_Queue_AddsQueueModifier
✅ TriggerModifierBuilder_Target_AddsTargetModifier
✅ TriggerModifierBuilder_Throttle_AddsThrottleModifier
✅ TriggerModifierBuilder_WithCondition_AddsCorrectCondition