Fix quick reparse input refresh
This commit is contained in:
@@ -80,7 +80,7 @@
|
||||
</div>
|
||||
<div class="field-shell">
|
||||
<label>Quick Parse Input</label>
|
||||
<InputTextArea class="input-shell critical-editor-textarea tall" @bind-Value="Model.QuickParseInput" />
|
||||
<InputTextArea class="input-shell critical-editor-textarea tall" @bind-Value="Model.QuickParseInput" @bind-Value:event="oninput" />
|
||||
</div>
|
||||
<p class="muted critical-editor-advanced-hint">Example: <code>Foe brings his guard up, frightened by your display.</code> then <code>+5, 1mp</code> or <code>w/o shield: glancing blow, +15, 3s, 3np</code>.</p>
|
||||
<div class="critical-editor-quick-legend">
|
||||
|
||||
@@ -333,6 +333,43 @@ public sealed class CriticalCellReparseIntegrationTests
|
||||
Assert.Contains(reparsed.GeneratedState!.Effects, effect => effect.EffectCode == AppCriticalEffectCodes.MustParryRounds && effect.DurationRounds == 1);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Lookup_service_reparse_updates_mana_c36_power_point_sign_when_quick_input_changes()
|
||||
{
|
||||
var databasePath = CreateTemporaryDatabaseCopy();
|
||||
var lookupService = new LookupService(CreateDbContextFactory(databasePath));
|
||||
var resultId = await GetResultIdAsync(databasePath, "mana", "C", "36-45");
|
||||
|
||||
var initialResponse = await lookupService.GetCriticalCellEditorAsync("mana", resultId);
|
||||
|
||||
Assert.NotNull(initialResponse);
|
||||
Assert.Contains("+2d10-16pp", initialResponse!.QuickParseInput, StringComparison.Ordinal);
|
||||
|
||||
var changedQuickParseInput = initialResponse.QuickParseInput.Replace("+2d10-16pp", "-2d10-16pp", StringComparison.Ordinal);
|
||||
var reparsed = await lookupService.ReparseCriticalCellAsync(
|
||||
"mana",
|
||||
resultId,
|
||||
new CriticalCellUpdateRequest(
|
||||
initialResponse.RawCellText,
|
||||
changedQuickParseInput,
|
||||
initialResponse.DescriptionText,
|
||||
initialResponse.RawAffixText,
|
||||
initialResponse.ParseStatus,
|
||||
initialResponse.ParsedJson,
|
||||
initialResponse.IsDescriptionOverridden,
|
||||
initialResponse.IsRawAffixTextOverridden,
|
||||
initialResponse.AreEffectsOverridden,
|
||||
initialResponse.AreBranchesOverridden,
|
||||
initialResponse.Effects,
|
||||
initialResponse.Branches));
|
||||
|
||||
Assert.NotNull(reparsed);
|
||||
Assert.Equal(changedQuickParseInput, reparsed!.QuickParseInput);
|
||||
Assert.Contains(reparsed.Effects, effect => effect.EffectCode == AppCriticalEffectCodes.PowerPointModifier && effect.ValueExpression == "-2d10-16");
|
||||
Assert.NotNull(reparsed.GeneratedState);
|
||||
Assert.Contains(reparsed.GeneratedState!.Effects, effect => effect.EffectCode == AppCriticalEffectCodes.PowerPointModifier && effect.ValueExpression == "-2d10-16");
|
||||
}
|
||||
|
||||
private static CriticalCellUpdateRequest CreateEditorRequest(
|
||||
string rawCellText,
|
||||
string descriptionText,
|
||||
|
||||
Reference in New Issue
Block a user