parent
9f46d03447
commit
0b4b54ffbf
|
@ -18,7 +18,28 @@
|
|||
"${workspaceRoot}/Tests/Tests.csproj"
|
||||
],
|
||||
"isTestCommand": true,
|
||||
"problemMatcher": "$msCompile"
|
||||
"problemMatcher": {
|
||||
"owner": "external",
|
||||
"fileLocation": "absolute",
|
||||
"severity": "error",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^Error Message:\\s*$"
|
||||
},
|
||||
{
|
||||
"regexp": "^\\s*(.*)$",
|
||||
"message": 1
|
||||
},
|
||||
{
|
||||
"regexp": "^Stack Trace:\\s*$"
|
||||
},
|
||||
{
|
||||
"regexp": "^\\s*at (.*\\(\\)) in (.*):line (\\d+)$",
|
||||
"file": 2,
|
||||
"location": 3
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,9 +1,18 @@
|
|||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace Ooui
|
||||
{
|
||||
public class Button : FormControl
|
||||
{
|
||||
ButtonType typ = ButtonType.Submit;
|
||||
public ButtonType Type {
|
||||
get => typ;
|
||||
set => SetProperty (ref typ, value, "type");
|
||||
}
|
||||
|
||||
public event EventHandler Clicked {
|
||||
add => AddEventListener ("click", value);
|
||||
remove => RemoveEventListener ("click", value);
|
||||
|
@ -20,4 +29,15 @@ namespace Ooui
|
|||
Text = text;
|
||||
}
|
||||
}
|
||||
|
||||
[JsonConverter (typeof (StringEnumConverter))]
|
||||
public enum ButtonType
|
||||
{
|
||||
[EnumMember (Value = "submit")]
|
||||
Submit,
|
||||
[EnumMember (Value = "reset")]
|
||||
Reset,
|
||||
[EnumMember (Value = "button")]
|
||||
Button,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,5 +43,16 @@ namespace Tests
|
|||
b.Receive (Message.Event (b.Id, "click"));
|
||||
Assert.IsTrue (clicked);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ChangeButtonType ()
|
||||
{
|
||||
var b = new Button ();
|
||||
Assert.AreEqual (1, b.StateMessages.Count);
|
||||
Assert.AreEqual (ButtonType.Submit, b.Type);
|
||||
b.Type = ButtonType.Button;
|
||||
Assert.AreEqual (2, b.StateMessages.Count);
|
||||
Assert.AreEqual (ButtonType.Button, b.StateMessages[1].Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue