diff --git a/src/main/scala/scatan/Main.scala b/src/main/scala/scatan/Main.scala index 2c4c7130..54ac99db 100644 --- a/src/main/scala/scatan/Main.scala +++ b/src/main/scala/scatan/Main.scala @@ -7,11 +7,15 @@ import scatan.views.home.{HomeView, ScalaJsHomeView} import scatan.model.ApplicationState import scatan.views.home.{AboutView, ScalaJSAboutView} import scatan.controllers.home.{AboutController, AboutControllerImpl} -import scatan.mvc.lib.application.NavigableApplication -import scatan.mvc.lib.page.PageFactory -import scatan.mvc.lib.{Controller, Model, NavigableApplicationManager, ScalaJSView} +import scatan.lib.mvc.application.NavigableApplication +import scatan.lib.mvc.page.PageFactory +import scatan.lib.mvc.ScalaJSView +import scatan.lib.mvc.{Controller, Model, NavigableApplicationManager} import scala.util.Random +import lib.mvc.application.NavigableApplication +import lib.mvc.page.PageFactory +import lib.mvc.{NavigableApplicationManager, Model, Controller} // Route enum Pages(val pageFactory: PageFactory[?, ?, ApplicationState]): diff --git a/src/main/scala/scatan/controllers/game/GameController.scala b/src/main/scala/scatan/controllers/game/GameController.scala index 315b2965..59f79568 100644 --- a/src/main/scala/scatan/controllers/game/GameController.scala +++ b/src/main/scala/scatan/controllers/game/GameController.scala @@ -1,10 +1,10 @@ package scatan.controllers.game -import scatan.mvc.lib.Controller.Requirements -import scatan.mvc.lib.NavigableApplicationManager +import scatan.lib.mvc.Controller.Requirements +import scatan.lib.mvc.NavigableApplicationManager import scatan.Pages import scatan.model.ApplicationState -import scatan.mvc.lib.Controller +import scatan.lib.mvc.Controller import scatan.views.game.GameView trait GameController extends Controller: diff --git a/src/main/scala/scatan/controllers/game/SetUpController.scala b/src/main/scala/scatan/controllers/game/SetUpController.scala index d8a523a7..c55d897a 100644 --- a/src/main/scala/scatan/controllers/game/SetUpController.scala +++ b/src/main/scala/scatan/controllers/game/SetUpController.scala @@ -1,8 +1,8 @@ package scatan.controllers.game -import scatan.mvc.lib.Controller +import scatan.lib.mvc.Controller import scatan.views.game.SetUpView -import scatan.mvc.lib.NavigableApplicationManager +import scatan.lib.mvc.NavigableApplicationManager import scatan.Pages import scatan.model.ApplicationState diff --git a/src/main/scala/scatan/controllers/home/AboutController.scala b/src/main/scala/scatan/controllers/home/AboutController.scala index 588980c9..ea5a33ed 100644 --- a/src/main/scala/scatan/controllers/home/AboutController.scala +++ b/src/main/scala/scatan/controllers/home/AboutController.scala @@ -1,9 +1,10 @@ package scatan.controllers.home -import scatan.mvc.lib.Controller +import scatan.lib.mvc.Controller import scatan.model.ApplicationState import scatan.views.home.AboutView -import scatan.mvc.lib.NavigableApplicationManager +import scatan.lib.mvc.NavigableApplicationManager import scatan.Pages +import scatan.lib.mvc.{NavigableApplicationManager, Controller} trait AboutController extends Controller: def goToHome(): Unit diff --git a/src/main/scala/scatan/controllers/home/HomeController.scala b/src/main/scala/scatan/controllers/home/HomeController.scala index 6521cf4e..b9c01a29 100644 --- a/src/main/scala/scatan/controllers/home/HomeController.scala +++ b/src/main/scala/scatan/controllers/home/HomeController.scala @@ -1,11 +1,13 @@ package scatan.controllers.home -import scatan.mvc.lib.Controller +import scatan.lib.mvc.Controller import scatan.views.home.HomeView import scatan.Pages -import scatan.mvc.lib.application.NavigableApplication -import scatan.mvc.lib.NavigableApplicationManager +import scatan.lib.mvc.application.NavigableApplication +import scatan.lib.mvc.NavigableApplicationManager import scatan.model.ApplicationState +import scatan.lib.mvc.application.NavigableApplication +import scatan.lib.mvc.{NavigableApplicationManager, Controller} /** This is the controller for the home page. */ diff --git a/src/main/scala/scatan/mvc/lib/Controller.scala b/src/main/scala/scatan/lib/mvc/Controller.scala similarity index 92% rename from src/main/scala/scatan/mvc/lib/Controller.scala rename to src/main/scala/scatan/lib/mvc/Controller.scala index 68942e52..84a960c8 100644 --- a/src/main/scala/scatan/mvc/lib/Controller.scala +++ b/src/main/scala/scatan/lib/mvc/Controller.scala @@ -1,6 +1,6 @@ -package scatan.mvc.lib +package scatan.lib.mvc -import scatan.mvc.lib +import scatan.lib.mvc trait Controller diff --git a/src/main/scala/scatan/mvc/lib/Model.scala b/src/main/scala/scatan/lib/mvc/Model.scala similarity index 92% rename from src/main/scala/scatan/mvc/lib/Model.scala rename to src/main/scala/scatan/lib/mvc/Model.scala index 664d9acf..e53505eb 100644 --- a/src/main/scala/scatan/mvc/lib/Model.scala +++ b/src/main/scala/scatan/lib/mvc/Model.scala @@ -1,4 +1,4 @@ -package scatan.mvc.lib +package scatan.lib.mvc trait Model[S <: Model.State](private var _state: S): def state: S = _state diff --git a/src/main/scala/scatan/mvc/lib/NavigableApplicationManager.scala b/src/main/scala/scatan/lib/mvc/NavigableApplicationManager.scala similarity index 84% rename from src/main/scala/scatan/mvc/lib/NavigableApplicationManager.scala rename to src/main/scala/scatan/lib/mvc/NavigableApplicationManager.scala index b478c67a..011e1aa4 100644 --- a/src/main/scala/scatan/mvc/lib/NavigableApplicationManager.scala +++ b/src/main/scala/scatan/lib/mvc/NavigableApplicationManager.scala @@ -1,6 +1,6 @@ -package scatan.mvc.lib +package scatan.lib.mvc -import scatan.mvc.lib.application.{Application, NavigableApplication} +import scatan.lib.mvc.application.{Application, NavigableApplication} object NavigableApplicationManager: private var _application: Option[NavigableApplication[?, ?]] = None diff --git a/src/main/scala/scatan/mvc/lib/ScalaJSView.scala b/src/main/scala/scatan/lib/mvc/ScalaJSView.scala similarity index 90% rename from src/main/scala/scatan/mvc/lib/ScalaJSView.scala rename to src/main/scala/scatan/lib/mvc/ScalaJSView.scala index ea3ed61e..3f911267 100644 --- a/src/main/scala/scatan/mvc/lib/ScalaJSView.scala +++ b/src/main/scala/scatan/lib/mvc/ScalaJSView.scala @@ -1,7 +1,8 @@ -package scatan.mvc.lib +package scatan.lib.mvc import org.scalajs.dom import com.raquo.laminar.api.L.* +import scatan.lib.mvc.View trait ScalaJSView(val container: String) extends View: def element: Element diff --git a/src/main/scala/scatan/mvc/lib/View.scala b/src/main/scala/scatan/lib/mvc/View.scala similarity index 94% rename from src/main/scala/scatan/mvc/lib/View.scala rename to src/main/scala/scatan/lib/mvc/View.scala index 4e2e80f0..37a76ef5 100644 --- a/src/main/scala/scatan/mvc/lib/View.scala +++ b/src/main/scala/scatan/lib/mvc/View.scala @@ -1,4 +1,4 @@ -package scatan.mvc.lib +package scatan.lib.mvc trait View: def show(): Unit diff --git a/src/main/scala/scatan/mvc/lib/application/Application.scala b/src/main/scala/scatan/lib/mvc/application/Application.scala similarity index 89% rename from src/main/scala/scatan/mvc/lib/application/Application.scala rename to src/main/scala/scatan/lib/mvc/application/Application.scala index 783b157b..62e4e28f 100644 --- a/src/main/scala/scatan/mvc/lib/application/Application.scala +++ b/src/main/scala/scatan/lib/mvc/application/Application.scala @@ -1,7 +1,8 @@ -package scatan.mvc.lib.application +package scatan.lib.mvc.application -import scatan.mvc.lib.Model -import scatan.mvc.lib.page.{ApplicationPage, PageFactory} +import scatan.lib.mvc.* +import scatan.lib.mvc.page.* +import scatan.lib.mvc.application.* /** An application is a collection of pages that share a model. * diff --git a/src/main/scala/scatan/mvc/lib/application/Navigable.scala b/src/main/scala/scatan/lib/mvc/application/Navigable.scala similarity index 89% rename from src/main/scala/scatan/mvc/lib/application/Navigable.scala rename to src/main/scala/scatan/lib/mvc/application/Navigable.scala index e4104630..adeb9c78 100644 --- a/src/main/scala/scatan/mvc/lib/application/Navigable.scala +++ b/src/main/scala/scatan/lib/mvc/application/Navigable.scala @@ -1,7 +1,7 @@ -package scatan.mvc.lib.application +package scatan.lib.mvc.application -import scatan.mvc.lib.* -import scatan.mvc.lib.page.{ApplicationPage, PageFactory} +import scatan.lib.mvc.* +import scatan.lib.mvc.page.{ApplicationPage, PageFactory} trait Navigable[Route] extends Application[?, Route]: private var pagesHistory: Seq[Route] = Seq.empty diff --git a/src/main/scala/scatan/mvc/lib/page/ApplicationPage.scala b/src/main/scala/scatan/lib/mvc/page/ApplicationPage.scala similarity index 95% rename from src/main/scala/scatan/mvc/lib/page/ApplicationPage.scala rename to src/main/scala/scatan/lib/mvc/page/ApplicationPage.scala index 87385d4d..04db39cc 100644 --- a/src/main/scala/scatan/mvc/lib/page/ApplicationPage.scala +++ b/src/main/scala/scatan/lib/mvc/page/ApplicationPage.scala @@ -1,6 +1,6 @@ -package scatan.mvc.lib.page +package scatan.lib.mvc.page -import scatan.mvc.lib.* +import scatan.lib.mvc.* /** A page of an application. It is a combination of a model, a view and a controller. * diff --git a/src/main/scala/scatan/mvc/lib/page/PageFactory.scala b/src/main/scala/scatan/lib/mvc/page/PageFactory.scala similarity index 68% rename from src/main/scala/scatan/mvc/lib/page/PageFactory.scala rename to src/main/scala/scatan/lib/mvc/page/PageFactory.scala index 4728bbbb..6a493fdc 100644 --- a/src/main/scala/scatan/mvc/lib/page/PageFactory.scala +++ b/src/main/scala/scatan/lib/mvc/page/PageFactory.scala @@ -1,6 +1,6 @@ -package scatan.mvc.lib.page +package scatan.lib.mvc.page -import scatan.mvc.lib.{Controller, Model, View} +import scatan.lib.mvc.{Controller, Model, View} case class PageFactory[C <: Controller, V <: View, S <: Model.State]( viewFactory: View.Factory[C, V], diff --git a/src/main/scala/scatan/model/ApplicationState.scala b/src/main/scala/scatan/model/ApplicationState.scala index dfb474db..79dedf1b 100644 --- a/src/main/scala/scatan/model/ApplicationState.scala +++ b/src/main/scala/scatan/model/ApplicationState.scala @@ -1,5 +1,6 @@ package scatan.model -import scatan.mvc.lib.Model +import scatan.lib.mvc.Model +import scatan.lib.mvc.Model final case class ApplicationState() extends Model.State diff --git a/src/main/scala/scatan/views/game/GameView.scala b/src/main/scala/scatan/views/game/GameView.scala index 0cef1eae..c9a1f297 100644 --- a/src/main/scala/scatan/views/game/GameView.scala +++ b/src/main/scala/scatan/views/game/GameView.scala @@ -4,7 +4,7 @@ import scatan.controllers.game.GameController import scatan.Pages import com.raquo.laminar.api.L.* -import scatan.mvc.lib.{ScalaJSView, View} +import scatan.lib.mvc.{ScalaJSView, View} import scatan.model.Spot import scatan.model.map.Hexagon import scatan.model.GameMap diff --git a/src/main/scala/scatan/views/game/SetUpView.scala b/src/main/scala/scatan/views/game/SetUpView.scala index 816d8975..390ea329 100644 --- a/src/main/scala/scatan/views/game/SetUpView.scala +++ b/src/main/scala/scatan/views/game/SetUpView.scala @@ -3,11 +3,12 @@ package scatan.views.game import scatan.controllers.game.SetUpController import scatan.Pages -import scatan.mvc.lib.View +import scatan.lib.mvc.View import scatan.controllers.game.SetUpController import com.raquo.laminar.api.L.* -import scatan.mvc.lib.{ScalaJSView, View} +import scatan.lib.mvc.{ScalaJSView, View} import scatan.Pages +import scatan.lib.mvc.{View, ScalaJSView} /** This is the view for the setup page. */ diff --git a/src/main/scala/scatan/views/home/AboutView.scala b/src/main/scala/scatan/views/home/AboutView.scala index a0dba97d..b578249d 100644 --- a/src/main/scala/scatan/views/home/AboutView.scala +++ b/src/main/scala/scatan/views/home/AboutView.scala @@ -1,8 +1,9 @@ package scatan.views.home import com.raquo.laminar.api.L.* -import scatan.mvc.lib.{ScalaJSView, View} +import scatan.lib.mvc.{ScalaJSView, View} import scatan.controllers.home.AboutController +import scatan.lib.mvc.{View, ScalaJSView} trait AboutView extends View diff --git a/src/main/scala/scatan/views/home/HomeView.scala b/src/main/scala/scatan/views/home/HomeView.scala index 78498aea..7d6b050c 100644 --- a/src/main/scala/scatan/views/home/HomeView.scala +++ b/src/main/scala/scatan/views/home/HomeView.scala @@ -1,11 +1,12 @@ package scatan.views.home -import scatan.mvc.lib.View +import scatan.lib.mvc.View import scatan.controllers.home.HomeController import com.raquo.laminar.api.L.* import scatan.Pages -import scatan.mvc.lib.{ScalaJSView, View} +import scatan.lib.mvc.{ScalaJSView, View} +import scatan.lib.mvc.{View, ScalaJSView} /** This is the view for the home page. */ diff --git a/src/test/scala/scatan/mvc/lib/ModelTest.scala b/src/test/scala/scatan/mvc/lib/ModelTest.scala index 990d61b5..7dbcd00d 100644 --- a/src/test/scala/scatan/mvc/lib/ModelTest.scala +++ b/src/test/scala/scatan/mvc/lib/ModelTest.scala @@ -1,9 +1,10 @@ -package scatan.mvc.lib +package scatan.lib.mvc import org.scalatest.flatspec.AnyFlatSpec import org.scalatest.matchers.should.Matchers.* +import scatan.BaseTest -class ModelTest extends AnyFlatSpec: +class ModelTest extends BaseTest: "The Model Object" should "contains the State trait" in { val temp: Model.State = new Model.State {} @@ -12,9 +13,7 @@ class ModelTest extends AnyFlatSpec: it should "be creatable with a State" in { val state: Model.State = new Model.State {} val model: Model[Model.State] = Model(state) - model should not be null model.state should be(state) - model.isInstanceOf[Model[?]] should be(true) } it should "contains the Provider trait" in {