-
Notifications
You must be signed in to change notification settings - Fork 97
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 #1057 from riganti/static-command-tests
Static command tests
- Loading branch information
Showing
11 changed files
with
937 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
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
25 changes: 25 additions & 0 deletions
25
...mmon/ViewModels/FeatureSamples/JavascriptTranslation/StringMethodTranslationsViewModel.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,25 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using DotVVM.Framework.ViewModel; | ||
|
||
namespace DotVVM.Samples.Common.ViewModels.FeatureSamples.JavascriptTranslation | ||
{ | ||
public class StringMethodTranslationsViewModel : DotvvmViewModelBase | ||
{ | ||
public string Joke { get; set; } = "Why do Java programmers have to wear glasses? Because they do not C#."; | ||
|
||
public string OperationResult { get; set; } | ||
public string Value { get; set; } = ""; | ||
|
||
public string[] SplitArray { get; set; } | ||
public int Index { get; set; } | ||
|
||
public List<string> JoinList { get; set; } = new List<string> { "Real", "programmers", "count", "from", "0" }; | ||
|
||
public string[] JoinArray { get; set; } = { "Real", "programmers", "count", "from", "0" }; | ||
} | ||
} | ||
|
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
46 changes: 46 additions & 0 deletions
46
...amples.Common/Views/FeatureSamples/JavascriptTranslation/StringMethodTranslations.dothtml
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,46 @@ | ||
@viewModel DotVVM.Samples.Common.ViewModels.FeatureSamples.JavascriptTranslation.StringMethodTranslationsViewModel, DotVVM.Samples.Common | ||
|
||
<!DOCTYPE html> | ||
|
||
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title></title> | ||
</head> | ||
<body> | ||
|
||
<h2 data-ui="main-text">{{value:Joke}}</h2> | ||
<p>Value</p><dot:TextBox Text="{value: Value}" data-ui="textbox" /> | ||
<dot:Button Text="Contains(value)" Click="{staticCommand: OperationResult = Joke.Contains(Value).ToString()}" /> | ||
<dot:Button Text="EndsWith(value)" Click="{staticCommand: OperationResult = Joke.EndsWith(Value).ToString()}" /> | ||
|
||
<dot:Button Text="IndexOf(value)" Click="{staticCommand: Index = Joke.IndexOf(Value)}" /> | ||
<dot:Button Text="IndexOf(value,30)" Click="{staticCommand: Index = Joke.IndexOf(Value, 30)}" /> | ||
|
||
<dot:Button Text="IsNullOrEmpty(value)" Click="{staticCommand: OperationResult = String.IsNullOrEmpty(Value).ToString()}" /> | ||
|
||
<dot:Button Text="Join(., list)" Click="{staticCommand: OperationResult = String.Join('.', JoinList)}" /> | ||
<dot:Button Text="Join( JOIN , array)" Click="{staticCommand: OperationResult = String.Join(" JOIN ", JoinArray)}" /> | ||
|
||
<dot:Button Text="LastIndexOf(value)" Click="{staticCommand: Index = Joke.LastIndexOf(Value)}" /> | ||
<dot:Button Text="LastIndexOf(value, 30)" Click="{staticCommand: Index = Joke.LastIndexOf(Value, 30)}" /> | ||
|
||
<dot:Button Text="Replace(a, A)" Click="{staticCommand: OperationResult = Joke.Replace("a", "A")}" /> | ||
|
||
<dot:Button Text="Split((char)?)" Click="{staticCommand: SplitArray = Joke.Split('?')}" /> | ||
<dot:Button Text="Split((string)do)" Click="{staticCommand: SplitArray = Joke.Split("do")}" /> | ||
|
||
<dot:Button Text="ToLower()" Click="{staticCommand: OperationResult = Joke.ToLower()}" /> | ||
<dot:Button Text="ToUpper()" Click="{staticCommand: OperationResult = Joke.ToUpper()}" /> | ||
|
||
<p>Operation result</p><h2 data-ui="operation-result">{{value: OperationResult}}</h2> | ||
<p>IndexOf result:</p> <h2 data-ui="index-result">{{value: Index}}</h2> | ||
|
||
<dot:Repeater DataSource="{value: SplitArray}" data-ui="repeater"> | ||
<p>{{value: _this}}</p> | ||
</dot:Repeater> | ||
|
||
</body> | ||
</html> | ||
|
||
|
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
Oops, something went wrong.