it('should parse one period with extra spaces', function () { var result = parse('* normal # Normal Schedule \n8:05 First Period ') result['normal'].name.should.equal('normal') result['normal'].display.should.equal('Normal Schedule') result['normal'].periods[0].time.should.deep.equal({ hour: 8, min: 5 }) result['normal'].periods[0].display({}).should.equal('First Period') })
render() { return ( <div className="row"> <div className="col-sm mb-4"> <h5> <span className="small text-uppercase text-muted d-block">{this.props.name}</span> {[this.props.range.from.toDateString(), ' - ', this.props.range.to.toDateString()]} </h5> </div> <div className="col-sm text-sm-right mb-4"> <ButtonGroup> { Header.periods.map(p => <Button key={p} value={p} selected={this.props.period === p} togglable={true} onClick={this.changePeriod} >{`${p} Months`} </Button>) } </ButtonGroup> </div> </div> ); }
it('should parse no periods', function () { var result = parse('* holiday # Holiday\n') result['holiday'].name.should.equal('holiday') result['holiday'].display.should.equal('Holiday') result['holiday'].periods.length.should.equal(0) })
it('should parse one period with format', function () { var result = parse('* normal # Normal Schedule\n8:05 {Period 1}') result['normal'].name.should.equal('normal') result['normal'].display.should.equal('Normal Schedule') result['normal'].periods[0].time.should.deep.equal({ hour: 8, min: 5 }) result['normal'].periods[0].display({ 'Period 1': 'Wind Ensemble' }).should.equal('Wind Ensemble') })
it('should parse one period', function () { var result = parse('* normal # Normal Schedule\n8:05 First Period') result['normal'].name.should.equal('normal') result['normal'].display.should.equal('Normal Schedule') result['normal'].periods[0].time.should.deep.equal({ hour: 8, min: 5 }) result['normal'].periods[0].display({}).should.equal('First Period') })
it('should parse one period with format with literals', function () { var result = parse('* normal # Normal Schedule\n8:05 Passing to {Period 1}') result['normal'].name.should.equal('normal') result['normal'].display.should.equal('Normal Schedule') result['normal'].periods[0].time.should.deep.equal({ hour: 8, min: 5 }) result['normal'].periods[0].display({ 'Period 1': 'Wind Ensemble' }).should.equal('Passing to Wind Ensemble') })
it('should parse one period with no bindings', function () { var result = parse('* normal # Normal Schedule\n8:05 {Period 0}') result['normal'].name.should.equal('normal') result['normal'].display.should.equal('Normal Schedule') result['normal'].periods[0].time.should.deep.equal({ hour: 8, min: 5 }) result['normal'].periods[0].display().should.equal('Period 0') })