package Ġorg . example . datepicker Ċ Ċ import Ġkotlinx . html . InputType Ċ import Ġkotlinx . html . dom . create Ċ import Ġkotlinx . html . js . div Ċ import Ġkotlinx . html . js . input Ċ import Ġorg . example .* Ċ import Ġorg . junit . Test Ċ import Ġorg . w 3 c . dom . HTML Div Element Ċ import Ġorg . w 3 c . dom . HTMLElement Ċ import Ġorg . w 3 c . dom . HTML InputElement Ċ import Ġorg . w 3 c . dom . asList Ċ import Ġkotlin . browser . document Ċ import Ġkotlin . js . Date Ċ import Ġkotlin . test . assertEquals Ċ import Ġkotlin . test . assertNot Equals Ċ import Ġkotlin . test . assertTrue Ċ Ċ /** Ċ Ġ* ĠCreated Ġby Ġg il bert . Ċ Ġ* Ċ Ġ* ĠDate Ġpicker Ġtests . Ċ Ġ*/ Ċ class ĠDate Picker Test Ġ{ ĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġval ĠDATE _ P ICK ER _ SELECTED Ġ= Ġ"." Ġ+ ĠDate Picker . DATE _ P ICK ER _ SELECTED _ CSS _ CLASS ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġval Ġdate : ĠDate Ġby Ġlazy Ġ{ ĊĠĠĠĠĠĠĠ ĠDate (). apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġas Dynamic (). setDate ( 1 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġas Dynamic (). set Month ( 0 ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġas Dynamic (). set Full Year ( 2 0 1 7 ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĠĠĠ Ġprivate Ġval Ġinput DatePicker : ĠHTML InputElement Ġby Ġlazy Ġ{ ĊĠĠĠĠĠĠĠ Ġdocument . create . input ( type Ġ= ĠInput Type . text ) Ġ{} ĊĠĠĠ Ġ} ĊĠĠĠ Ġprivate Ġval Ġdate Picker : ĠDate Picker Ġby Ġlazy Ġ{ ĊĠĠĠĠĠĠĠ Ġdocument . create . div Ġ{} . appendChild ( input DatePicker ) ĊĠĠĠĠĠĠĠ Ġval Ġparams Ġ= Ġdate Picker Model ( input DatePicker , Ġdate Ġ= Ġdate , Ġshow Filters Ġ= Ġtrue ) ĊĠĠĠĠĠĠĠ ĠDate Picker ( params ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Build DatePicker With Filter () Ġ{ ĊĠĠĠĠĠĠĠ Ġdate Picker ĊĠĠĠĠĠĠĠ Ġval Ġdate Picker View Ġ= Ġinput DatePicker . nextElement Sibling Ġas ĠHTML Div Element ĊĠĠĠĠĠĠĠ Ġval Ġexpected Ġ= Ġ""" < div Ġid =" datepicker " Ġstyle =" display : Ġnone ;">< div Ġclass =" datepicker - calendar ">< nav Ġclass =" datepicker - header ">< div Ġclass =" datepicker - prev ">< i Ġclass =" material - icons "> keyboard _ arrow _ left </ i ></ div >< div Ġclass =" datepicker - title ">< span > January Ġ 2 0 1 7 </ span ></ div >< div Ġclass =" datepicker - next ">< i Ġclass =" material - icons "> keyboard _ arrow _ right </ i ></ div ></ nav >< table Ġclass =" datepicker - days ">< thead >< tr >< th >< span Ġclass =" datepicker - day name " Ġtitle =" S unday "> Su </ span ></ th >< th >< span Ġclass =" datepicker - day name " Ġtitle =" Monday "> Mo </ span ></ th >< th >< span Ġclass =" datepicker - day name " Ġtitle =" Tuesday "> Tu </ span ></ th >< th >< span Ġclass =" datepicker - day name " Ġtitle =" Wednesday "> We </ span ></ th >< th >< span Ġclass =" datepicker - day name " Ġtitle =" Thursday "> Th </ span ></ th >< th >< span Ġclass =" datepicker - day name " Ġtitle =" Friday "> Fr </ span ></ th >< th >< span Ġclass =" datepicker - day name " Ġtitle =" Saturday "> Sa </ span ></ th ></ tr ></ thead >< tbody >< tr >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 3 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 4 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 5 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 6 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 7 </ td ></ tr >< tr >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 8 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 9 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 0 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 1 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 2 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 3 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 4 </ td ></ tr >< tr >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 5 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 6 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 7 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 8 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 9 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 0 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 1 </ td ></ tr >< tr >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 2 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 3 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 4 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 5 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 6 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 7 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 8 </ td ></ tr >< tr >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 9 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 3 0 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 3 1 </ td >< td ></ td >< td ></ td >< td ></ td >< td ></ td ></ tr >< tr ></ tr ></ tbody ></ table ></ div >< div Ġclass =" datepicker - filter ">< h 4 > Filter Ġcalendar Ġby : Ġ</ h 4 >< input Ġtype =" radio " Ġname =" filter " Ġclass =" state " Ġid =" any " Ġchecked =" checked ">< input Ġtype =" radio " Ġname =" filter " Ġclass =" state " Ġid =" week days ">< input Ġtype =" radio " Ġname =" filter " Ġclass =" state " Ġid =" week ends ">< div Ġclass =" tabs ">< label Ġclass =" tab " Ġfor =" any " Ġid =" label - any "> Any Ġdate </ label >< label Ġclass =" tab " Ġfor =" week days " Ġid =" label - week days "> Only Ġweek days </ label >< label Ġclass =" tab " Ġfor =" week ends " Ġid =" label - week ends "> Only Ġweek ends </ label ></ div ></ div ></ div > """ ĊĠĠĠĠĠĠĠ ĠassertEquals ( expected , Ġdate Picker View . outer HTML ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Build DatePicker Without Filter () Ġ{ ĊĠĠĠĠĠĠĠ Ġdocument . create . div Ġ{} . appendChild ( input DatePicker ) ĊĠĠĠĠĠĠĠ Ġval Ġparams Ġ= Ġdate Picker Model ( input DatePicker , Ġdate Ġ= Ġdate ) ĊĠĠĠĠĠĠĠ ĠDate Picker ( params ) ĊĊĠĠĠĠĠĠĠ Ġval Ġdate Picker View Ġ= Ġinput DatePicker . nextElement Sibling Ġas ĠHTML Div Element ĊĠĠĠĠĠĠĠ Ġval Ġexpected Ġ= Ġ""" < div Ġid =" datepicker " Ġstyle =" display : Ġnone ;">< div Ġclass =" datepicker - calendar ">< nav Ġclass =" datepicker - header ">< div Ġclass =" datepicker - prev ">< i Ġclass =" material - icons "> keyboard _ arrow _ left </ i ></ div >< div Ġclass =" datepicker - title ">< span > January Ġ 2 0 1 7 </ span ></ div >< div Ġclass =" datepicker - next ">< i Ġclass =" material - icons "> keyboard _ arrow _ right </ i ></ div ></ nav >< table Ġclass =" datepicker - days ">< thead >< tr >< th >< span Ġclass =" datepicker - day name " Ġtitle =" S unday "> Su </ span ></ th >< th >< span Ġclass =" datepicker - day name " Ġtitle =" Monday "> Mo </ span ></ th >< th >< span Ġclass =" datepicker - day name " Ġtitle =" Tuesday "> Tu </ span ></ th >< th >< span Ġclass =" datepicker - day name " Ġtitle =" Wednesday "> We </ span ></ th >< th >< span Ġclass =" datepicker - day name " Ġtitle =" Thursday "> Th </ span ></ th >< th >< span Ġclass =" datepicker - day name " Ġtitle =" Friday "> Fr </ span ></ th >< th >< span Ġclass =" datepicker - day name " Ġtitle =" Saturday "> Sa </ span ></ th ></ tr ></ thead >< tbody >< tr >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 3 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 4 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 5 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 6 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 7 </ td ></ tr >< tr >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 8 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 9 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 0 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 1 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 2 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 3 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 4 </ td ></ tr >< tr >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 5 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 6 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 7 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 8 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 9 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 0 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 1 </ td ></ tr >< tr >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 2 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 3 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 4 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 5 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 6 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 7 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 8 </ td ></ tr >< tr >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 9 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 3 0 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 3 1 </ td >< td ></ td >< td ></ td >< td ></ td >< td ></ td ></ tr >< tr ></ tr ></ tbody ></ table ></ div ></ div > """ ĊĠĠĠĠĠĠĠ ĠassertEquals ( expected , Ġdate Picker View . outer HTML ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Show DatePicker () Ġ{ ĊĠĠĠĠĠĠĠ Ġdate Picker ĊĠĠĠĠĠĠĠ Ġinput DatePicker . click () ĊĠĠĠĠĠĠĠ Ġval Ġdate Picker View Ġ= Ġinput DatePicker . nextElement Sibling Ġas ĠHTML Div Element ĊĠĠĠĠĠĠĠ Ġassert Not Equals (" none ", Ġdate Picker View . style . display ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Go One Month Ago On Prev Clicked () Ġ{ ĊĠĠĠĠĠĠĠ Ġdate Picker ĊĠĠĠĠĠĠĠ Ġinput DatePicker . click () ĊĠĠĠĠĠĠĠ Ġval Ġdate Picker View Ġ= Ġinput DatePicker . nextElement Sibling Ġas ĠHTML Div Element ĊĠĠĠĠĠĠĠ Ġval Ġprevious Div Ġ= Ġdate Picker View . querySelector (". datepicker - prev ") Ġas ĠHTMLElement ĊĠĠĠĠĠĠĠ Ġprevious Div . click () ĊĊĠĠĠĠĠĠĠ Ġval Ġexpected Ġ= Ġ""" < div Ġid =" datepicker " Ġstyle =" display : Ġflex ;">< div Ġclass =" datepicker - calendar ">< nav Ġclass =" datepicker - header ">< div Ġclass =" datepicker - prev ">< i Ġclass =" material - icons "> keyboard _ arrow _ left </ i ></ div >< div Ġclass =" datepicker - title ">< span > De cember Ġ 2 0 1 6 </ span ></ div >< div Ġclass =" datepicker - next ">< i Ġclass =" material - icons "> keyboard _ arrow _ right </ i ></ div ></ nav >< table Ġclass =" datepicker - days ">< thead >< tr >< th >< span Ġclass =" datepicker - day name " Ġtitle =" S unday "> Su </ span ></ th >< th >< span Ġclass =" datepicker - day name " Ġtitle =" Monday "> Mo </ span ></ th >< th >< span Ġclass =" datepicker - day name " Ġtitle =" Tuesday "> Tu </ span ></ th >< th >< span Ġclass =" datepicker - day name " Ġtitle =" Wednesday "> We </ span ></ th >< th >< span Ġclass =" datepicker - day name " Ġtitle =" Thursday "> Th </ span ></ th >< th >< span Ġclass =" datepicker - day name " Ġtitle =" Friday "> Fr </ span ></ th >< th >< span Ġclass =" datepicker - day name " Ġtitle =" Saturday "> Sa </ span ></ th ></ tr ></ thead >< tbody >< tr >< td ></ td >< td ></ td >< td ></ td >< td ></ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 3 </ td ></ tr >< tr >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 4 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 5 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 6 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 7 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 8 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 9 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 0 </ td ></ tr >< tr >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 1 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 2 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 3 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 4 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 5 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 6 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 7 </ td ></ tr >< tr >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 8 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 9 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 0 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 1 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 2 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 3 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 4 </ td ></ tr >< tr >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 5 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 6 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 7 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 8 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 9 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 3 0 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 3 1 </ td ></ tr >< tr ></ tr ></ tbody ></ table ></ div >< div Ġclass =" datepicker - filter ">< h 4 > Filter Ġcalendar Ġby : Ġ</ h 4 >< input Ġtype =" radio " Ġname =" filter " Ġclass =" state " Ġid =" any " Ġchecked =" checked ">< input Ġtype =" radio " Ġname =" filter " Ġclass =" state " Ġid =" week days ">< input Ġtype =" radio " Ġname =" filter " Ġclass =" state " Ġid =" week ends ">< div Ġclass =" tabs ">< label Ġclass =" tab " Ġfor =" any " Ġid =" label - any "> Any Ġdate </ label >< label Ġclass =" tab " Ġfor =" week days " Ġid =" label - week days "> Only Ġweek days </ label >< label Ġclass =" tab " Ġfor =" week ends " Ġid =" label - week ends "> Only Ġweek ends </ label ></ div ></ div ></ div > """ ĊĠĠĠĠĠĠĠ ĠassertEquals ( expected , Ġdate Picker View . outer HTML ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Go Next Month Ago On Next Clicked () Ġ{ ĊĠĠĠĠĠĠĠ Ġdate Picker ĊĠĠĠĠĠĠĠ Ġinput DatePicker . click () ĊĠĠĠĠĠĠĠ Ġval Ġdate Picker View Ġ= Ġinput DatePicker . nextElement Sibling Ġas ĠHTML Div Element ĊĠĠĠĠĠĠĠ Ġval Ġprevious Div Ġ= Ġdate Picker View . querySelector (". datepicker - next ") Ġas ĠHTMLElement ĊĠĠĠĠĠĠĠ Ġprevious Div . click () ĊĊĠĠĠĠĠĠĠ Ġval Ġexpected Ġ= Ġ""" < div Ġid =" datepicker " Ġstyle =" display : Ġflex ;">< div Ġclass =" datepicker - calendar ">< nav Ġclass =" datepicker - header ">< div Ġclass =" datepicker - prev ">< i Ġclass =" material - icons "> keyboard _ arrow _ left </ i ></ div >< div Ġclass =" datepicker - title ">< span > Fe bruary Ġ 2 0 1 7 </ span ></ div >< div Ġclass =" datepicker - next ">< i Ġclass =" material - icons "> keyboard _ arrow _ right </ i ></ div ></ nav >< table Ġclass =" datepicker - days ">< thead >< tr >< th >< span Ġclass =" datepicker - day name " Ġtitle =" S unday "> Su </ span ></ th >< th >< span Ġclass =" datepicker - day name " Ġtitle =" Monday "> Mo </ span ></ th >< th >< span Ġclass =" datepicker - day name " Ġtitle =" Tuesday "> Tu </ span ></ th >< th >< span Ġclass =" datepicker - day name " Ġtitle =" Wednesday "> We </ span ></ th >< th >< span Ġclass =" datepicker - day name " Ġtitle =" Thursday "> Th </ span ></ th >< th >< span Ġclass =" datepicker - day name " Ġtitle =" Friday "> Fr </ span ></ th >< th >< span Ġclass =" datepicker - day name " Ġtitle =" Saturday "> Sa </ span ></ th ></ tr ></ thead >< tbody >< tr >< td ></ td >< td ></ td >< td ></ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 3 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 4 </ td ></ tr >< tr >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 5 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 6 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 7 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 8 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 9 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 0 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 1 </ td ></ tr >< tr >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 2 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 3 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 4 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 5 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 6 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 7 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 8 </ td ></ tr >< tr >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 1 9 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 0 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 1 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 2 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 3 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 4 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 5 </ td ></ tr >< tr >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 6 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 7 </ td >< td Ġclass =" datepicker - day Ġdate picker - disabled "> 2 8 </ td >< td ></ td >< td ></ td >< td ></ td >< td ></ td ></ tr >< tr ></ tr ></ tbody ></ table ></ div >< div Ġclass =" datepicker - filter ">< h 4 > Filter Ġcalendar Ġby : Ġ</ h 4 >< input Ġtype =" radio " Ġname =" filter " Ġclass =" state " Ġid =" any " Ġchecked =" checked ">< input Ġtype =" radio " Ġname =" filter " Ġclass =" state " Ġid =" week days ">< input Ġtype =" radio " Ġname =" filter " Ġclass =" state " Ġid =" week ends ">< div Ġclass =" tabs ">< label Ġclass =" tab " Ġfor =" any " Ġid =" label - any "> Any Ġdate </ label >< label Ġclass =" tab " Ġfor =" week days " Ġid =" label - week days "> Only Ġweek days </ label >< label Ġclass =" tab " Ġfor =" week ends " Ġid =" label - week ends "> Only Ġweek ends </ label ></ div ></ div ></ div > """ ĊĠĠĠĠĠĠĠ ĠassertEquals ( expected , Ġdate Picker View . outer HTML ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Select Day () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdate Ġ= ĠDate () ĊĠĠĠĠĠĠĠ Ġdocument . create . div Ġ{} . appendChild ( input DatePicker ) ĊĠĠĠĠĠĠĠ Ġval Ġparams Ġ= Ġdate Picker Model ( input DatePicker ) ĊĠĠĠĠĠĠĠ ĠDate Picker ( params ) ĊĠĠĠĠĠĠĠ Ġinput DatePicker . click () ĊĠĠĠĠĠĠĠ Ġval Ġdate Picker View Ġ= Ġinput DatePicker . nextElement Sibling Ġas ĠHTML Div Element ĊĠĠĠĠĠĠĠ Ġvar Ġselected Day Ġ= Ġdate Picker View . querySelector ( DATE _ P ICK ER _ SELECTED ) Ġas ĠHTMLElement ĊĠĠĠĠĠĠĠ Ġval Ġnext Day Ġ= Ġselected Day . nextElement Sibling Ġas ĠHTMLElement ĊĠĠĠĠĠĠĠ Ġif Ġ( next Day Ġ!= Ġnull ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġnext Day . click () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġdate . setDate ( date . getDate () Ġ+ Ġ 1 ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġselected Day Ġ= Ġdate Picker View . querySelectorAll ( DATE _ P ICK ER _ SELECTED ). asList (). last () Ġas ĠHTMLElement ĊĠĠĠĠĠĠĠ ĠassertEquals (( date . getDate ()). toString (), Ġselected Day . innerText ) ĊĠĠĠĠĠĠĠ ĠassertEquals ( date . to Short String (), Ġinput DatePicker . value ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Get Date () Ġ{ ĊĠĠĠĠĠĠĠ ĠassertEquals (" 0 1 / 0 1 / 2 0 1 7 ", Ġdate Picker . getDate (). to Short String ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Select Element () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdate Picker Ġ= Ġselect Element () ĊĠĠĠĠĠĠĠ ĠassertEquals ( date Picker . getDate (). to Short String (), Ġinput DatePicker . value ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠSelect Ġa Ġdate Ġin Ġthe Ġdate Picker Ġcomponent ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġprivate Ġfun Ġselect Element (): ĠDate Picker Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdate Ġ= ĠDate () ĊĠĠĠĠĠĠĠ Ġdocument . create . div Ġ{} . appendChild ( input DatePicker ) ĊĠĠĠĠĠĠĠ Ġval Ġparams Ġ= Ġdate Picker Model ( input DatePicker ) ĊĠĠĠĠĠĠĠ Ġval Ġdate Picker Ġ= ĠDate Picker ( params ) ĊĠĠĠĠĠĠĠ Ġinput DatePicker . click () ĊĠĠĠĠĠĠĠ Ġval Ġdate Picker View Ġ= Ġinput DatePicker . nextElement Sibling Ġas ĠHTML Div Element ĊĠĠĠĠĠĠĠ Ġvar Ġselected Day Ġ= Ġdate Picker View . querySelector ( DATE _ P ICK ER _ SELECTED ) Ġas ĠHTMLElement ĊĠĠĠĠĠĠĠ Ġval Ġnext Day Ġ= Ġselected Day . nextElement Sibling Ġas ĠHTMLElement ĊĊĠĠĠĠĠĠĠ Ġif Ġ( next Day Ġ!= Ġnull ) Ġdate . setDate ( date . getDate () Ġ+ Ġ 1 ) ĊĠĠĠĠĠĠĠ Ġval Ġday Ġ= ĠDay ( date , Ġselected Ġ= Ġtrue ) ĊĠĠĠĠĠĠĠ Ġdate Picker . select ( next Day , Ġday ) ĊĠĠĠĠĠĠĠ Ġreturn Ġdate Picker ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Clear Value () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdate Picker Ġ= Ġselect Element () ĊĠĠĠĠĠĠĠ Ġdate Picker . clear () ĊĠĠĠĠĠĠĠ ĠassertEquals ("", Ġinput DatePicker . value ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Filter Week end () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdate Picker View Ġ= Ġcreate Filtered DatePicker ( Filter Calendar . WEEK END S ) ĊĊĠĠĠĠĠĠĠ Ġdate Picker View . querySelectorAll (" td : not (. datepicker - disabled ) "). asList (). forEach Ġ{ Ġday Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( day Ġis ĠHTMLElement Ġ&& Ġday . innerText . isNotEmpty ()) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġday Date Ġ= ĠDate () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġday Date . setDate ( day . innerText . toInt ()) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠassertTrue Ġ{ Ġday Date . is Week end () Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġshould Filter Week day () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdate Picker View Ġ= Ġcreate Filtered DatePicker ( Filter Calendar . WEEK DAYS ) ĊĊĠĠĠĠĠĠĠ Ġdate Picker View . querySelectorAll (" td : not (. datepicker - disabled ) "). asList (). forEach Ġ{ Ġday Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( day Ġis ĠHTMLElement Ġ&& Ġday . innerText . isNotEmpty ()) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġday Date Ġ= ĠDate () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġday Date . setDate ( day . innerText . toInt ()) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠassertTrue Ġ{ Ġday Date . is Week day () Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠCreates Ġa Ġdate Ġpicker Ġcomponent Ġwith Ġthe Ġgiven Ġfilter ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġprivate Ġfun Ġcreate Filtered DatePicker ( filter Calendar : ĠFilter Calendar ): ĠHTML Div Element Ġ{ ĊĠĠĠĠĠĠĠ Ġdocument . create . div Ġ{} . appendChild ( input DatePicker ) ĊĠĠĠĠĠĠĠ Ġval Ġparams Ġ= Ġdate Picker Model ( input DatePicker , Ġshow Filters Ġ= Ġtrue , Ġfilter Ġ= Ġfilter Calendar ) ĊĠĠĠĠĠĠĠ ĠDate Picker ( params ) ĊĠĠĠĠĠĠĠ Ġval Ġdate Picker View Ġ= Ġinput DatePicker . nextElement Sibling Ġas ĠHTML Div Element ĊĠĠĠĠĠĠĠ Ġreturn Ġdate Picker View ĊĠĠĠ Ġ} Ċ }