Skip to content

Commit d886b93

Browse files
committed
added a new file with examples of how to use dates
1 parent 15d180a commit d886b93

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
describe('Calendar Tests', () => {
2+
before(() => {
3+
cy.visit('/')
4+
})
5+
6+
it.only('Should have a "Today" button visible', () => {
7+
cy.isVisible('.fc-today-button')
8+
})
9+
10+
it('Should have a "Now line" displayed', () => {
11+
cy.get('.fc-timegrid-now-indicator-line').should('exist')
12+
})
13+
14+
it('should check for correct font in title ', () => {
15+
cy.get('h2.fc-toolbar-title').should('have.css', 'font-family')
16+
.and('match', /Averta/)
17+
})
18+
19+
it('should click on tomorrow\'s arrow and be taken to next day', () => {
20+
function join(t, a, s) {
21+
function format(m) {
22+
let f = new Intl.DateTimeFormat('en', m);
23+
return f.format(t);
24+
}
25+
return a.map(format).join(s);
26+
}
27+
28+
let a = [{month: 'long'}, {day: 'numeric'}, {year: 'numeric'}];
29+
let s = join(new Date(), a, ',');
30+
let newDate = s.replace(',', ' ')
31+
32+
cy.get('.fc-next-button').click()
33+
cy.get('.fc-toolbar-title').should('not.have.text', newDate)
34+
})
35+
36+
it('should return to today\'s date after clicking the today button', () => {
37+
function join(t, a, s) {
38+
function format(m) {
39+
let f = new Intl.DateTimeFormat('en', m);
40+
return f.format(t);
41+
}
42+
return a.map(format).join(s);
43+
}
44+
45+
let a = [{month: 'long'}, {day: 'numeric'}];
46+
let s = join(new Date(), a, ',');
47+
let newDate = s.replace(',', ' ')
48+
cy.get('button')
49+
.contains('Today')
50+
.click()
51+
52+
cy.get('h2')
53+
.contains(newDate.replace(',', ', '))
54+
})
55+
56+
it('should have 4 resources in the calendar', () => {
57+
cy.get('.fc-col-header-cell.fc-resource').as('resource_column')
58+
cy.get('@resource_column')
59+
.its('length')
60+
.should('eq', 4, { log: true })
61+
})
62+
63+
})

jenkins.war

70.8 MB
Binary file not shown.

0 commit comments

Comments
 (0)