From ea265413e9b99d2843024ed0eaa8cc3a63da42b8 Mon Sep 17 00:00:00 2001 From: "Yang, Bo" Date: Thu, 3 Oct 2019 22:07:01 -0700 Subject: [PATCH] Run scalafmt --- .scalafmt.conf | 4 +- .../com/thoughtworks/binding/domTest.scala | 66 ++++++++++++------- 2 files changed, 44 insertions(+), 26 deletions(-) diff --git a/.scalafmt.conf b/.scalafmt.conf index f216dbfd..47765dc5 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,2 +1,2 @@ -version = "1.5.1" -maxColumn = 120 \ No newline at end of file +version = "2.0.1" +maxColumn = 120 diff --git a/dom/src/test/scala/com/thoughtworks/binding/domTest.scala b/dom/src/test/scala/com/thoughtworks/binding/domTest.scala index 79b8a3d1..6d0bd0af 100644 --- a/dom/src/test/scala/com/thoughtworks/binding/domTest.scala +++ b/dom/src/test/scala/com/thoughtworks/binding/domTest.scala @@ -20,7 +20,7 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ + */ package com.thoughtworks.binding @@ -79,8 +79,8 @@ final class domTest extends FreeSpec with Matchers { } "ForYield" in { - val v0 = Vars("original text 0","original text 1") - @dom val monadicDiv: Binding[Div] =
{ for (s <- v0) yield {s} }
+ val v0 = Vars("original text 0", "original text 1") + @dom val monadicDiv: Binding[Div] =
{for (s <- v0) yield {s}}
monadicDiv.watch() val div = monadicDiv.get @@ -88,7 +88,9 @@ final class domTest extends FreeSpec with Matchers { v0.value.prepend("prepended") assert(div eq monadicDiv.get) - assert(monadicDiv.get.outerHTML == "
prependedoriginal text 0original text 1
") + assert( + monadicDiv.get.outerHTML == "
prependedoriginal text 0original text 1
" + ) v0.value.remove(1) assert(div eq monadicDiv.get) @@ -142,12 +144,18 @@ final class domTest extends FreeSpec with Matchers { @dom val tableBinding = { - {tbodyBinding.bind}
First NameSecond NameAge
+ { + tbodyBinding.bind + }
First NameSecond NameAge
} tableBinding.watch() - assert(tableBinding.get.outerHTML == """
First NameSecond NameAge
SteveJobs10
TimCook12
JeffLauren13
""") + assert( + tableBinding.get.outerHTML == """
First NameSecond NameAge
SteveJobs10
TimCook12
JeffLauren13
""" + ) filterPattern.value = "o" - assert(tableBinding.get.outerHTML == """
First NameSecond NameAge
SteveJobs10
TimCook12
""") + assert( + tableBinding.get.outerHTML == """
First NameSecond NameAge
SteveJobs10
TimCook12
""" + ) } "NodeSeq" in { @@ -174,17 +182,21 @@ final class domTest extends FreeSpec with Matchers { "reference by id from nested content" in { @dom def innerDiv = { -

The tagName of current Div is { `my-div`.tagName }. The tagName of current Paragraph is { myParagraph.tagName }.

+

The tagName of current Div is {`my-div`.tagName}. The tagName of current Paragraph is { + myParagraph.tagName + }.

} val div = document.createElement("div") dom.render(div, innerDiv) val outerHTML = div.outerHTML - assert(outerHTML == """

The tagName of current Div is DIV. The tagName of current Paragraph is P.

""") + assert( + outerHTML == """

The tagName of current Div is DIV. The tagName of current Paragraph is P.

""" + ) } "reference by id from content" in { @dom def innerDiv = { -

The tagName of current element is { currentElement.tagName }.

+

The tagName of current element is {currentElement.tagName}.

} val div = document.createElement("div") dom.render(div, innerDiv) @@ -194,7 +206,7 @@ final class domTest extends FreeSpec with Matchers { "reference by id from attributes" in { @dom def input = { -
+
} val div = document.createElement("div") dom.render(div, input) @@ -283,7 +295,8 @@ final class domTest extends FreeSpec with Matchers { "id in BindingSeq" in { val v = Var("Initial value") - @dom val input = v.value = s"${foo.tagName} and ${bar.innerHTML}"} value={ v.bind }/>

+ @dom val input = + v.value = s"${foo.tagName} and ${bar.innerHTML}"} value={v.bind}/>

val div = document.createElement("div") dom.render(div, input) assert(v.value == "Initial value") @@ -296,7 +309,7 @@ final class domTest extends FreeSpec with Matchers { "id in Binding" in { val v = Var("Initial value") @dom val input = { - v.value = s"${foo.tagName}"}/> + v.value = s"${foo.tagName}"}/> foo.value = v.bind foo } @@ -326,7 +339,7 @@ final class domTest extends FreeSpec with Matchers { "Option" in { val warning = Var(true) - @dom val text = if(warning.bind) Some(warning) else None + @dom val text = if (warning.bind) Some(warning) else None @dom val div =
{text.bind}
div.watch() @@ -362,20 +375,23 @@ final class domTest extends FreeSpec with Matchers { assert(hr.get.outerHTML == """
""") } - "reference by local-id from nested content" in { @dom def innerDiv = { -

The tagName of current Div is { `my-div`.tagName }. The tagName of current Paragraph is { myParagraph.tagName }.

+

The tagName of current Div is { + `my-div`.tagName + }. The tagName of current Paragraph is {myParagraph.tagName}.

} val div = document.createElement("div") dom.render(div, innerDiv) val outerHTML = div.outerHTML - assert(outerHTML == """

The tagName of current Div is DIV. The tagName of current Paragraph is P.

""") + assert( + outerHTML == """

The tagName of current Div is DIV. The tagName of current Paragraph is P.

""" + ) } "reference by local-id from content" in { @dom def innerDiv = { -

The tagName of current element is { currentElement.tagName }.

+

The tagName of current element is {currentElement.tagName}.

} val div = document.createElement("div") dom.render(div, innerDiv) @@ -395,7 +411,7 @@ final class domTest extends FreeSpec with Matchers { "local-id takes precedence over the id attribute" in { @dom def input = { -
+
} val div = document.createElement("div") dom.render(div, input) @@ -405,7 +421,8 @@ final class domTest extends FreeSpec with Matchers { "local-id in BindingSeq" in { val v = Var("Initial value") - @dom val input = v.value = s"${foo.tagName} and ${bar.innerHTML}"} value={ v.bind }/>

+ @dom val input = + v.value = s"${foo.tagName} and ${bar.innerHTML}"} value={v.bind}/>

val div = document.createElement("div") dom.render(div, input) assert(v.value == "Initial value") @@ -418,7 +435,7 @@ final class domTest extends FreeSpec with Matchers { "local-id in Binding" in { val v = Var("Initial value") @dom val input = { - v.value = s"${foo.tagName}"}/> + v.value = s"${foo.tagName}"}/> foo.value = v.bind foo } @@ -432,7 +449,7 @@ final class domTest extends FreeSpec with Matchers { } "dashed-local-id should compile" in { - @dom def div =
+ @dom def div =
div.watch() assert(div.get.className == "DIV-1") } @@ -444,8 +461,9 @@ final class domTest extends FreeSpec with Matchers { val div = document.createElement("div") dom.render(div, tag) - assert(div.outerHTML == """
CUSTOM-TAG
""") + assert( + div.outerHTML == """
CUSTOM-TAG
""" + ) } } -