-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
452 additions
and
395 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
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
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
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
1 change: 0 additions & 1 deletion
1
src/Util.Ui.NgZorro/Components/TreeSelects/Renders/TreeSelectRender.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
1 change: 0 additions & 1 deletion
1
src/Util.Ui.NgZorro/Components/TreeSelects/TreeSelectTagHelper.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
84 changes: 57 additions & 27 deletions
84
test/Util.Ui.NgZorro.Tests/Buttons/ButtonTagHelperTest.Extend.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 |
---|---|---|
@@ -1,35 +1,65 @@ | ||
using System.Text; | ||
using Util.Ui.Configs; | ||
using Util.Ui.NgZorro.Configs; | ||
using Xunit; | ||
|
||
namespace Util.Ui.NgZorro.Tests.Buttons { | ||
namespace Util.Ui.NgZorro.Tests.Buttons; | ||
|
||
/// <summary> | ||
/// 按钮测试 - 指令扩展 | ||
/// </summary> | ||
public partial class ButtonTagHelperTest { | ||
/// <summary> | ||
/// 测试是否验证表单 | ||
/// </summary> | ||
[Fact] | ||
public void TestValidateForm_1() { | ||
_wrapper.SetContextAttribute( UiConst.ValidateForm, true ); | ||
_wrapper.SetContextAttribute( UiConst.OnClick, "test()" ); | ||
var result = new StringBuilder(); | ||
result.Append( "<button #x_id=\"xButtonExtend\" (click)=\"x_id.validateForm();test()\" nz-button=\"\" x-button-extend=\"\"></button>" ); | ||
Assert.Equal( result.ToString(), GetResult() ); | ||
} | ||
|
||
/// <summary> | ||
/// 测试是否验证表单 - 指定按钮标识 | ||
/// </summary> | ||
[Fact] | ||
public void TestValidateForm_2() { | ||
_wrapper.SetContextAttribute( UiConst.ValidateForm, true ); | ||
_wrapper.SetContextAttribute( UiConst.Id, "a" ); | ||
_wrapper.SetContextAttribute( UiConst.OnClick, "test()" ); | ||
var result = new StringBuilder(); | ||
result.Append( "<button #a=\"\" #x_a=\"xButtonExtend\" (click)=\"x_a.validateForm();test()\" nz-button=\"\" x-button-extend=\"\"></button>" ); | ||
Assert.Equal( result.ToString(), GetResult() ); | ||
} | ||
|
||
/// <summary> | ||
/// 按钮测试 - 指令扩展 | ||
/// 测试复制到剪贴板 | ||
/// </summary> | ||
public partial class ButtonTagHelperTest { | ||
/// <summary> | ||
/// 测试是否验证表单 | ||
/// </summary> | ||
[Fact] | ||
public void TestValidateForm_1() { | ||
_wrapper.SetContextAttribute( UiConst.ValidateForm, true ); | ||
_wrapper.SetContextAttribute( UiConst.OnClick, "test()" ); | ||
var result = new StringBuilder(); | ||
result.Append( "<button #x_id=\"xButtonExtend\" (click)=\"x_id.validateForm();test()\" nz-button=\"\" x-button-extend=\"\"></button>" ); | ||
Assert.Equal( result.ToString(), GetResult() ); | ||
} | ||
[Fact] | ||
public void TestCopyToClipboard() { | ||
_wrapper.SetContextAttribute( UiConst.CopyToClipboard, "a" ); | ||
var result = new StringBuilder(); | ||
result.Append( "<button #x_id=\"xButtonExtend\" (click)=\"x_id.copyToClipboard(a)\" " ); | ||
result.Append( "nz-button=\"\" nz-tooltip=\"\" nzTooltipTitle=\"复制到剪贴板\" nzType=\"text\" x-button-extend=\"\">" ); | ||
result.Append( "<i nz-icon=\"\" nzType=\"copy\"></i>" ); | ||
result.Append( "</button>" ); | ||
Assert.Equal( result.ToString(), GetResult() ); | ||
} | ||
|
||
/// <summary> | ||
/// 测试是否验证表单 - 指定按钮标识 | ||
/// </summary> | ||
[Fact] | ||
public void TestValidateForm_2() { | ||
_wrapper.SetContextAttribute( UiConst.ValidateForm, true ); | ||
_wrapper.SetContextAttribute( UiConst.Id, "a" ); | ||
_wrapper.SetContextAttribute( UiConst.OnClick, "test()" ); | ||
var result = new StringBuilder(); | ||
result.Append( "<button #a=\"\" #x_a=\"xButtonExtend\" (click)=\"x_a.validateForm();test()\" nz-button=\"\" x-button-extend=\"\"></button>" ); | ||
Assert.Equal( result.ToString(), GetResult() ); | ||
} | ||
/// <summary> | ||
/// 测试复制到剪贴板 - 多语言 | ||
/// </summary> | ||
[Fact] | ||
public void TestCopyToClipboard_I18n() { | ||
NgZorroOptionsService.SetOptions( new NgZorroOptions { EnableI18n = true } ); | ||
_wrapper.SetContextAttribute( UiConst.CopyToClipboard, "a" ); | ||
var result = new StringBuilder(); | ||
result.Append( "<button #x_id=\"xButtonExtend\" (click)=\"x_id.copyToClipboard(a)\" " ); | ||
result.Append( "nz-button=\"\" nz-tooltip=\"\" nzType=\"text\" x-button-extend=\"\" [nzTooltipTitle]=\"'util.copyToClipboard'|i18n\">" ); | ||
result.Append( "<i nz-icon=\"\" nzType=\"copy\"></i>" ); | ||
result.Append( "</button>" ); | ||
Assert.Equal( result.ToString(), GetResult() ); | ||
} | ||
} | ||
} |
Oops, something went wrong.