Use new WriteJson method in Sessions
This commit is contained in:
parent
0ada0c7497
commit
b5dadbceb9
|
@ -40,8 +40,11 @@ namespace Ooui
|
||||||
{
|
{
|
||||||
w.Write ('\"');
|
w.Write ('\"');
|
||||||
for (var i = 0; i < s.Length; i++) {
|
for (var i = 0; i < s.Length; i++) {
|
||||||
var c = s[0];
|
var c = s[i];
|
||||||
if (c == '\r') {
|
if (c == '\"') {
|
||||||
|
w.Write ("\\\"");
|
||||||
|
}
|
||||||
|
else if (c == '\r') {
|
||||||
w.Write ("\\r");
|
w.Write ("\\r");
|
||||||
}
|
}
|
||||||
else if (c == '\n') {
|
else if (c == '\n') {
|
||||||
|
|
|
@ -29,9 +29,11 @@ namespace Tests
|
||||||
var b = new Button ();
|
var b = new Button ();
|
||||||
b.Text = "Hello";
|
b.Text = "Hello";
|
||||||
b.Click += (sender, e) => { };
|
b.Click += (sender, e) => { };
|
||||||
|
b.Title = "\"Quote\"";
|
||||||
Assert.AreEqual ("{\"m\":\"create\",\"id\":\"⦙\",\"k\":\"button\"}", NoId (b.StateMessages[0].ToJson ()));
|
Assert.AreEqual ("{\"m\":\"create\",\"id\":\"⦙\",\"k\":\"button\"}", NoId (b.StateMessages[0].ToJson ()));
|
||||||
Assert.AreEqual ("{\"m\":\"call\",\"id\":\"⦙\",\"k\":\"insertBefore\",\"v\":[\"⦙\",null]}", NoId (b.StateMessages[1].ToJson ()));
|
Assert.AreEqual ("{\"m\":\"call\",\"id\":\"⦙\",\"k\":\"insertBefore\",\"v\":[\"⦙\",null]}", NoId (b.StateMessages[1].ToJson ()));
|
||||||
Assert.AreEqual ("{\"m\":\"listen\",\"id\":\"⦙\",\"k\":\"click\"}", NoId (b.StateMessages[2].ToJson ()));
|
Assert.AreEqual ("{\"m\":\"listen\",\"id\":\"⦙\",\"k\":\"click\"}", NoId (b.StateMessages[2].ToJson ()));
|
||||||
|
Assert.AreEqual ("{\"m\":\"setAttr\",\"id\":\"⦙\",\"k\":\"title\",\"v\":\"\\\"Quote\\\"\"}", NoId (b.StateMessages[3].ToJson ()));
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
|
Loading…
Reference in New Issue