Skip to content

Commit

Permalink
Merge pull request #243 from DuneSt/241-testDisplayDateOn-is-failing-…
Browse files Browse the repository at this point in the history
…once-every-two-months

241-testDisplayDateOn-is-failing-once-every-two-months
  • Loading branch information
jecisc committed Feb 28, 2019
2 parents dc965a6 + df0f5ea commit dbaad42
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 16 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
<!--git log --pretty="* %s ([%h](https://github.com/DuneSt/MaterialDesignLite/commit/%H))" v1.3.2...HEAD-->
<!--git log --pretty="* %s ([%h](https://github.com/DuneSt/MaterialDesignLite/commit/%H)) v1.3.2...HEAD --grep="Merge "-->


# [v2.1.2](https://github.com/DuneSt/MaterialDesignLite/compare/v2.1.1...v2.1.2) (2019-02-28)

## Bug fix

* Fix failing test (testDisplayDateOn) ([848315](https://github.com/DuneSt/MaterialDesignLite/commit/8483153286c64fb6cc1e127d9f71c19582c789d4))

# [v2.1.1](https://github.com/DuneSt/MaterialDesignLite/compare/v2.1.0...v2.1.1) (2019-02-11)

## Bug fix
Expand Down
2 changes: 1 addition & 1 deletion src/Material-Design-Lite-Demo/MDLDemo.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ MDLDemo class >> open [

{ #category : #versions }
MDLDemo class >> version [
^ 'v2.1.1'
^ 'v2.1.2'
]

{ #category : #hooks }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
Class {
#name : #MDLCalendarWidgetTest,
#name : #MDLDatePickerTest,
#superclass : #MDLAbstractSeasideTestCase,
#instVars : [
'calendar'
],
#category : 'Material-Design-Lite-Widgets-Tests-Calendar'
#category : #'Material-Design-Lite-Widgets-Tests-Calendar'
}

{ #category : #running }
MDLCalendarWidgetTest >> setUp [
MDLDatePickerTest >> setUp [
super setUp.
calendar := MDLDatePicker new
]

{ #category : #tests }
MDLCalendarWidgetTest >> testDisplayDateOn [
MDLDatePickerTest >> testDisplayDateOn [
| today tommorrow afterTommorrow nextMonth |
today := Date today.
tommorrow := (DateAndTime today + 1 days) asDate.
Expand All @@ -28,46 +28,48 @@ MDLCalendarWidgetTest >> testDisplayDateOn [
self assert: [ :html | calendar displayDate: tommorrow on: html ] generatedIncludes: 'mdl-color-text--primary-contrast mdl-color--primary'.

self deny: [ :html | calendar displayDate: tommorrow on: html ] generatedIncludes: 'disabled'.

calendar currentDate: today.
self assert: [ :html | calendar displayDate: nextMonth on: html ] generatedIncludes: 'disabled'
]

{ #category : #tests }
MDLCalendarWidgetTest >> testGoToNextMonth [
MDLDatePickerTest >> testGoToNextMonth [
calendar currentDate: (Date year: 2016 month: 4 day: 10).
calendar goToNextMonth.
self assert: calendar currentDate asMonth equals: (Month month: 5 year: 2016).
self assert: calendar currentDate equals: (Date year: 2016 month: 5 day: 10)
]

{ #category : #tests }
MDLCalendarWidgetTest >> testGoToPreviousMonth [
MDLDatePickerTest >> testGoToPreviousMonth [
calendar currentDate: (Date year: 2016 month: 4 day: 10).
calendar goToPreviousMonth.
self assert: calendar currentDate asMonth equals: (Month month: 3 year: 2016).
self assert: calendar currentDate equals: (Date year: 2016 month: 3 day: 10)
]

{ #category : #tests }
MDLCalendarWidgetTest >> testId [
MDLDatePickerTest >> testId [
self deny: [ :html | html render: calendar ] generatedIncludes: 'id="testId"'.
calendar id: 'testId'.
self assert: [ :html | html render: calendar ] generatedIncludes: 'id="testId"'
]

{ #category : #tests }
MDLCalendarWidgetTest >> testIdIsEnsured [
MDLDatePickerTest >> testIdIsEnsured [
self assert: [ :html | html render: calendar ] generatedIncludes: 'id="id1"'
]

{ #category : #tests }
MDLCalendarWidgetTest >> testIsInCurrentMonth [
MDLDatePickerTest >> testIsInCurrentMonth [
calendar currentDate: (Date year: 2018 month: 6 day: 5).
self assert: (calendar isInCurrentMonth: (Date year: 2018 month: 6 day: 5)).
self deny: (calendar selectedDateIs: (Date year: 2018 month: 7 day: 4))
]

{ #category : #tests }
MDLCalendarWidgetTest >> testIsTodayAndNotSelected [
MDLDatePickerTest >> testIsTodayAndNotSelected [
| today tommorow |
today := Date today.
tommorow := (DateAndTime today + 1 days) asDate.
Expand All @@ -79,7 +81,7 @@ MDLCalendarWidgetTest >> testIsTodayAndNotSelected [
]

{ #category : #tests }
MDLCalendarWidgetTest >> testJsOnCompleteScript [
MDLDatePickerTest >> testJsOnCompleteScript [
calendar onCompleteScript: 'console.log("test")' js.
self assert: (calendar jsOnCompleteScript isKindOf: JSStream).
self assert: calendar jsOnCompleteScript contents equals: 'console.log("test")'.
Expand All @@ -89,21 +91,21 @@ MDLCalendarWidgetTest >> testJsOnCompleteScript [
]

{ #category : #tests }
MDLCalendarWidgetTest >> testRenderMonthesOn [
MDLDatePickerTest >> testRenderMonthesOn [
self assert: [ :html | calendar renderMonthesOn: html ] generatedIncludesAll: Date monthNames.
calendar currentDate: (Date year: 2018 month: 6 day: 5).
self assert: [ :html | calendar renderMonthesOn: html ] generatedIncludes: 'May</div><div class="mdl-cell month-cell active mdl-cell--4-col-desktop"' "June need to be active"
]

{ #category : #tests }
MDLCalendarWidgetTest >> testRenderYearsOn [
MDLDatePickerTest >> testRenderYearsOn [
self assert: [ :html | calendar renderYearsOn: html ] generatedIncludesAll: (calendar calendar yearsInterval collect: #asString).
calendar currentDate: (Date year: 2018 month: 6 day: 5).
self assert: [ :html | calendar renderYearsOn: html ] generatedIncludes: '2017</div><div class="mdl-cell year-cell active mdl-cell--4-col-desktop"' "2018 need to be active"
]

{ #category : #tests }
MDLCalendarWidgetTest >> testSelectedDateIs [
MDLDatePickerTest >> testSelectedDateIs [
calendar currentDate: (Date year: 2018 month: 6 day: 5).
self assert: (calendar selectedDateIs: (Date year: 2018 month: 6 day: 5)).
self deny: (calendar selectedDateIs: (Date year: 2018 month: 6 day: 4))
Expand Down

0 comments on commit dbaad42

Please sign in to comment.