Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed package of mvc library from mvc.lib to lib.mvc #8

Merged
merged 1 commit into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/main/scala/scatan/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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]):
Expand Down
6 changes: 3 additions & 3 deletions src/main/scala/scatan/controllers/game/GameController.scala
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/scatan/controllers/game/SetUpController.scala
Original file line number Diff line number Diff line change
@@ -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

Expand Down
5 changes: 3 additions & 2 deletions src/main/scala/scatan/controllers/home/AboutController.scala
Original file line number Diff line number Diff line change
@@ -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
Expand Down
8 changes: 5 additions & 3 deletions src/main/scala/scatan/controllers/home/HomeController.scala
Original file line number Diff line number Diff line change
@@ -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.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package scatan.mvc.lib
package scatan.lib.mvc

import scatan.mvc.lib
import scatan.lib.mvc

trait Controller

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package scatan.mvc.lib
package scatan.lib.mvc

trait View:
def show(): Unit
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -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],
Expand Down
3 changes: 2 additions & 1 deletion src/main/scala/scatan/model/ApplicationState.scala
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion src/main/scala/scatan/views/game/GameView.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions src/main/scala/scatan/views/game/SetUpView.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
3 changes: 2 additions & 1 deletion src/main/scala/scatan/views/home/AboutView.scala
Original file line number Diff line number Diff line change
@@ -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

Expand Down
5 changes: 3 additions & 2 deletions src/main/scala/scatan/views/home/HomeView.scala
Original file line number Diff line number Diff line change
@@ -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.
*/
Expand Down
7 changes: 3 additions & 4 deletions src/test/scala/scatan/mvc/lib/ModelTest.scala
Original file line number Diff line number Diff line change
@@ -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 {}
Expand All @@ -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 {
Expand Down