Skip to content

Commit f87d16d

Browse files
committed
fixes
1 parent 52d4308 commit f87d16d

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed

src/PrompterOne.Shared/Editor/Pages/EditorPage.SourceEditing.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ private Task OnSourceChangedAsync(string text)
7171

7272
if (sourceChanged)
7373
{
74-
_splitFeedback = null;
7574
Diagnostics.ClearRecoverable(SplitDraftOperation);
7675
}
7776

tests/PrompterOne.Web.Tests/Editor/EditorSplitFeedbackInteractionTests.cs

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,58 @@ public void EditorPage_SplitFeedbackStaysVisibleAcrossRedundantSourceChangeEvent
5858
});
5959
}
6060

61+
[Test]
62+
public void EditorPage_SplitFeedbackStaysVisibleAfterSourceEdits()
63+
{
64+
var navigationManager = Services.GetRequiredService<NavigationManager>();
65+
navigationManager.NavigateTo(AppTestData.Routes.EditorDemo);
66+
var cut = Render<EditorPage>();
67+
68+
cut.WaitForAssertion(() =>
69+
{
70+
var source = cut.FindByTestId(UiTestIds.Editor.SourceInput);
71+
Assert.Contains(AppTestData.Editor.BodyHeading, source.GetAttribute("value"));
72+
});
73+
74+
cut.FindByTestId(UiTestIds.Editor.SourceInput).Input(EditorSplitFeedbackInteractionTestSource.SplitSource);
75+
cut.FindByTestId(UiTestIds.Editor.SplitSegment).Click();
76+
77+
cut.WaitForAssertion(() =>
78+
{
79+
Assert.Equal(
80+
EditorSplitFeedbackInteractionTestSource.SplitActionLabel,
81+
cut.FindByTestId(UiTestIds.Editor.SplitResultOpenLibrary).TextContent.Trim());
82+
});
83+
84+
cut.FindByTestId(UiTestIds.Editor.SourceInput).Input(EditorSplitFeedbackInteractionTestSource.EditedSplitSource);
85+
86+
cut.WaitForAssertion(() =>
87+
{
88+
Assert.Equal(
89+
EditorSplitFeedbackInteractionTestSource.SplitActionLabel,
90+
cut.FindByTestId(UiTestIds.Editor.SplitResultOpenLibrary).TextContent.Trim());
91+
});
92+
93+
cut.FindByTestId(UiTestIds.Editor.SplitResultOpenLibrary).Click();
94+
95+
cut.WaitForAssertion(() =>
96+
{
97+
Assert.EndsWith(AppRoutes.Library, navigationManager.Uri, StringComparison.Ordinal);
98+
});
99+
}
100+
61101
private static class EditorSplitFeedbackInteractionTestSource
62102
{
103+
public const string EditedSplitSource =
104+
"""
105+
## [Episode 1 - How to Think About Systems|140WPM|Professional]
106+
Before you write code, / you need to think about the system. //
107+
108+
## [Episode 2 - How Systems Talk to Each Other|140WPM|Professional]
109+
APIs, events, and retries matter. //
110+
111+
Notes: keep the current draft open while reviewing the split.
112+
""";
63113
public const string SplitActionLabel = "Open in Library";
64114
public const string SplitFeedbackTitle = "Split complete";
65115
public const string SplitSource =

0 commit comments

Comments
 (0)