-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #344 from workgroupengineering/fixes/Issue_338
fix(Manupilation): Adding nested Tag renames parent closing element #338
- Loading branch information
Showing
5 changed files
with
129 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
tests/CompletionEngineTests/Manipulator/ManipulatorBasicTests.SynchronizeStartAndEndTag.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
using Xunit; | ||
|
||
namespace CompletionEngineTests.Manipulator; | ||
|
||
partial class ManipulatorBasicTests | ||
{ | ||
const string nestingRenameSource = """ | ||
<UserControl xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" | ||
x:Class="ACTest.Views.UserControl1"> | ||
<UserControl$ | ||
<TextBlock Text="Ciao"/> | ||
</UserControl> | ||
"""; | ||
|
||
const string nestingRenameExpected = """ | ||
<UserControl xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" | ||
x:Class="ACTest.Views.UserControl1"> | ||
<UserControld | ||
<TextBlock Text="Ciao"/> | ||
</UserControl> | ||
"""; | ||
|
||
const string scenario2Source = """ | ||
<UserControl$ xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" | ||
x:Class="ACTest.Views.UserControl1"> | ||
<UserControl | ||
<TextBlock Text="Ciao"/> | ||
</UserControl> | ||
"""; | ||
|
||
const string scenario2Expected = """ | ||
<UserControld xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" | ||
x:Class="ACTest.Views.UserControl1"> | ||
<UserControl | ||
<TextBlock Text="Ciao"/> | ||
</UserControld> | ||
"""; | ||
|
||
[Theory] | ||
[Scenario("Adding nested Tag renames parent closing element GitHub #338 ", nestingRenameExpected, nestingRenameSource)] | ||
[Scenario("Rename with invalid nested tag", scenario2Expected, scenario2Source)] | ||
public void SynchronizeStartAndEndTag(Scenario scenario) | ||
{ | ||
AssertInsertion((string)scenario.Agrument, "d", (string)scenario.Expected); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 1 addition & 3 deletions
4
tests/CompletionEngineTests/Manipulator/Util/ManipulatorTestBase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System.Collections.Generic; | ||
using System.Reflection; | ||
using Xunit.Sdk; | ||
|
||
namespace CompletionEngineTests; | ||
|
||
/// <summary> | ||
/// Test Scenario | ||
/// </summary> | ||
/// <param name="Description"></param> | ||
/// <param name="Expected"></param> | ||
/// <param name="Agrument"></param> | ||
public record class Scenario(string Description, object Expected, object Agrument) | ||
{ | ||
public override string ToString() | ||
{ | ||
return Description; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Provides a data source for a data theory, with the data coming from inline values. | ||
/// </summary> | ||
public sealed class ScenarioAttribute : DataAttribute | ||
{ | ||
readonly object[] data; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="ScenarioAttribute"/> class. | ||
/// </summary> | ||
/// <param name="description">The description of test scenario</param> | ||
/// <param name="expected">The expected value</param> | ||
/// <param name="agrument">The argument of pass to test method.</param> | ||
public ScenarioAttribute(string description, object expected, object agrument) | ||
{ | ||
Scenario scenario = new(description, expected, agrument); | ||
data = new object[] { scenario }; | ||
} | ||
|
||
/// <inheritdoc/> | ||
public override IEnumerable<object[]> GetData(MethodInfo testMethod) | ||
{ | ||
yield return data; | ||
} | ||
} |