forked from ThoughtWorksInc/Binding.scala
-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 changed file
with
2 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ import com.thoughtworks.binding.Binding.Var | |
import com.thoughtworks.binding.dom.Runtime.TagsAndTags2 | ||
import org.scalatest.{FreeSpec, Matchers} | ||
import org.scalajs.dom.html.Div | ||
import scalatags.JsDom | ||
|
||
/** | ||
* @author Leonid Turnaev <[email protected]> | ||
|
@@ -24,25 +23,9 @@ class ComponentModel extends FreeSpec with Matchers { | |
} | ||
|
||
"user defined tag component" in { | ||
import scala.language.implicitConversions | ||
|
||
class Dialog(val div: Div) { | ||
def caption: String = { | ||
div.getAttribute("dialog-caption") | ||
} | ||
def caption_=(caption: String): Unit = { | ||
div.setAttribute("dialog-caption", caption) | ||
} | ||
} | ||
|
||
object Dialog { | ||
implicit final def toDiv(tag: Dialog): Div = tag.div | ||
|
||
def render: Dialog = { | ||
val div = JsDom.tags.div.render | ||
div.className = "dialog" | ||
new Dialog(div) | ||
} | ||
@dom | ||
def apply(id: String, caption: Binding[String]): Binding[Div] = <div id={id} class="dialog" data:dialog-caption={caption.bind}/> | ||
} | ||
|
||
implicit final class UserTags(x: TagsAndTags2.type) { | ||
|