-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#201] Add unit tests for dynamic templates
- Loading branch information
Showing
7 changed files
with
86 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// $begin{copyright} | ||
// | ||
// This file is part of WebSharper | ||
// | ||
// Copyright (c) 2008-2018 IntelliFactory | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); you | ||
// may not use this file except in compliance with the License. You may | ||
// obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
// implied. See the License for the specific language governing | ||
// permissions and limitations under the License. | ||
// | ||
// $end{copyright} | ||
[<WebSharper.JavaScript>] | ||
module WebSharper.UI.ServerSide.Unit | ||
|
||
open WebSharper | ||
open WebSharper.JavaScript | ||
open WebSharper.Testing | ||
|
||
let Dynamic = TestCategory "Dynamic templates" { | ||
|
||
Test "was instantiated" { | ||
let elt = JS.Document.GetElementById("dynamic-1") | ||
equal elt.TextContent "[OK] Inserted using dynamic template" | ||
} | ||
|
||
Test "text hole is filled" { | ||
let elt = JS.Document.GetElementById("dynamic-2") | ||
equal elt.TextContent "[OK] Inserted using dynamic template text hole" | ||
} | ||
|
||
Test "doc hole is filled" { | ||
let elt = JS.Document.GetElementById("dynamic-3") | ||
equal elt.TextContent "[OK] Inserted using dynamic template doc hole" | ||
} | ||
|
||
Test "attr hole is filled" { | ||
let elt = JS.Document.GetElementById("dynamic-4") | ||
let style = JS.Window.GetComputedStyle(elt) | ||
equal (style.GetPropertyValue("margin-right")) "10px" | ||
} | ||
|
||
Test "onafterrender hole is filled" { | ||
let elt = JS.Document.GetElementById("dynamic-5") | ||
equal elt.TextContent "[OK] Inserted using dynamic afterrender hole" | ||
} | ||
|
||
Test "onmouseenter hole is filled" { | ||
let elt = JS.Document.GetElementById("dynamic-6") | ||
equal elt.TextContent "[OK] Inserted using dynamic mouse event hole" | ||
} | ||
|
||
} | ||
|
||
let RunAllTests() = | ||
Runner.RunTests [ | ||
Dynamic | ||
] |
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
WebSharper | ||
WebSharper.FSharp | ||
HtmlAgilityPack | ||
FSharp.Core | ||
FSharp.Core | ||
WebSharper.Testing |
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