Skip to content

Commit

Permalink
Disable PrimitiveH5P Checkbox, because it is not yet supported
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasweishaupt committed May 28, 2024
1 parent 8bcf9ae commit bb8f3b8
Show file tree
Hide file tree
Showing 4 changed files with 324 additions and 283 deletions.
17 changes: 10 additions & 7 deletions IntegrationTest/Forms/Element/CreateElementFormIt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,12 @@ public void NoContentAvailable_ShowsNoContentWarningInsteadOfTableSelect()
}

[Test]
[Ignore(
"PrimitiveH5P is not yet implemented in Backend, so this option should not yet be selectable in the authoring tool.",
Until = "2024-06-18")]
public void H5PContentSelected_ShowsPrimitiveCheckbox()
{
var content = new []
var content = new[]
{
ViewModelProvider.GetFileContent("foo", "h5p", "somepath")
};
Expand All @@ -301,20 +304,20 @@ public void H5PContentSelected_ShowsPrimitiveCheckbox()
Mapper.Map<ILearningContentFormModel>(content[0]).Returns(contentFormModels[0]);
var systemUnderTest = GetFormWithPopoverProvider();
var popover = systemUnderTest.FindComponent<MudPopoverProvider>();


var tableSelect = systemUnderTest.FindComponent<TableSelect<ILearningContentFormModel>>();
tableSelect.WaitForElements("tbody tr", TimeSpan.FromSeconds(2))[0].Click();

Assert.That(FormModel.LearningContent, Is.EqualTo(contentFormModels.First()));
Assert.That(FormModel.LearningContent, Is.TypeOf<FileContentFormModel>());
Assert.That(contentFormModels.First().PrimitiveH5P, Is.EqualTo(false));

var checkbox = systemUnderTest.FindComponent<MudCheckBox<bool>>();
Assert.That(checkbox.Instance.Value, Is.EqualTo(false));

checkbox.Find("input").Change(true);

Assert.That(contentFormModels.First().PrimitiveH5P, Is.EqualTo(true));
Assert.That(checkbox.Instance.Value, Is.EqualTo(true));
}
Expand Down
20 changes: 12 additions & 8 deletions IntegrationTest/Forms/Element/EditElementFormIt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,19 @@ public void SubmitThenRemapButton_CallsPresenterWithNewValues_ThenRemapsEntityIn

systemUnderTest.FindComponent<SubmitThenRemapButton>().Find("button").Click();

Assert.That(() => WorldPresenter.Received().EditLearningElementFromFormModel(ElementVm.Parent, ElementVm, FormModel),
Assert.That(
() => WorldPresenter.Received().EditLearningElementFromFormModel(ElementVm.Parent, ElementVm, FormModel),
Throws.Nothing);
Mapper.Received(1).Map(ElementVm, FormDataContainer.FormModel);
}

[Test]
[Ignore(
"PrimitiveH5P is not yet implemented in Backend, so this option should not yet be selectable in the authoring tool.",
Until = "2024-06-18")]
public void H5PContentSelected_ShowsPrimitiveCheckbox()
{
var content = new []
var content = new[]
{
ViewModelProvider.GetFileContent("foo", "h5p", "somepath")
};
Expand All @@ -182,20 +186,20 @@ public void H5PContentSelected_ShowsPrimitiveCheckbox()
Mapper.Map<ILearningContentFormModel>(content[0]).Returns(contentFormModels[0]);
var systemUnderTest = GetFormWithPopoverProvider();
var popover = systemUnderTest.FindComponent<MudPopoverProvider>();


var tableSelect = systemUnderTest.FindComponent<TableSelect<ILearningContentFormModel>>();
tableSelect.WaitForElements("tbody tr", TimeSpan.FromSeconds(2))[0].Click();

Assert.That(FormModel.LearningContent, Is.EqualTo(contentFormModels.First()));
Assert.That(FormModel.LearningContent, Is.TypeOf<FileContentFormModel>());
Assert.That(contentFormModels.First().PrimitiveH5P, Is.EqualTo(false));

var checkbox = systemUnderTest.FindComponent<MudCheckBox<bool>>();
Assert.That(checkbox.Instance.Value, Is.EqualTo(false));

checkbox.Find("input").Change(true);

Assert.That(contentFormModels.First().PrimitiveH5P, Is.EqualTo(true));
Assert.That(checkbox.Instance.Value, Is.EqualTo(true));
}
Expand Down
Loading

0 comments on commit bb8f3b8

Please sign in to comment.