diff --git a/package.json b/package.json
index 3e768a9..5a0a26f 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "project-invoice",
- "version": "3.0.11",
+ "version": "3.0.12",
"description": "Invoicing without sharing data.",
"keywords": [],
"main": "src/index.js",
diff --git a/public/static/i18n/en.json b/public/static/i18n/en.json
index 377bb61..5db6e04 100644
--- a/public/static/i18n/en.json
+++ b/public/static/i18n/en.json
@@ -154,7 +154,7 @@
"quotation": "quotation",
"quotationAfter": "text after",
"quotationBefore": "text before",
- "quotationDate": "datum",
+ "quotationDate": "date",
"quotationDuration": "project duration",
"quotationStartDate": "start date",
"quotationSubject": "project subject",
diff --git a/src/components/Tabs.js b/src/components/Tabs.js
index 592415e..a3ebeb5 100644
--- a/src/components/Tabs.js
+++ b/src/components/Tabs.js
@@ -51,7 +51,7 @@ const Tab = styled.button`
line-height: 100%;
}`
-export const Tabs = ({ currentIndex=0, children }) => {
+export const Tabs = ({ currentIndex=0, children, ...attr }) => {
const [selectedChildIndex, setSelectedChildIndex] = useState(currentIndex)
const tabs = children
.map(section=>firstChildType(section, 'h3'))
@@ -64,7 +64,7 @@ export const Tabs = ({ currentIndex=0, children }) => {
>
{children}
)
;
const selectedChild = children[selectedChildIndex]
- return
+ return
{selectedChild}
diff --git a/src/views/Project.js b/src/views/Project.js
index 4a9fbd1..b11b98a 100644
--- a/src/views/Project.js
+++ b/src/views/Project.js
@@ -278,8 +278,8 @@ export const Project = withRouter(
-
-
+
+
invoices
@@ -291,7 +291,7 @@ export const Project = withRouter(
>
-
+
{index===0?'invoice':'reminder'}
{index!==0?nbsp + index:''}
@@ -313,8 +313,8 @@ export const Project = withRouter(
-
- show quotation
+
+ show quotation
quotation
{[
{ key: 'quotationDate', Element: InputDate }
@@ -345,6 +345,7 @@ export const Project = withRouter(
const {bottom, height, left, right, top, width, x, y} = r
return {bottom: bottom-4, height, left, right, top, width, x, y}
}}
+ data-cy="dialog"
>
{invoice.type!=='invoice'&&<>
diff --git a/src/views/project.spec.js b/src/views/project.spec.js
index 664ce4e..ed88eeb 100644
--- a/src/views/project.spec.js
+++ b/src/views/project.spec.js
@@ -2,11 +2,16 @@
const clientUri = '/client/20'
const projectUri = `${clientUri}/114`
+const projectUriQuotation = `${clientUri}/114/quotation`
+const projectUriInvoice = `${clientUri}/114/invoice`
+const projectUriReminder = `${clientUri}/114/reminder/1`
const projectUriClone = `${clientUri}/115`
const projectUriPrevious = `${clientUri}/73`
-const projectDescription = 'Two barrels of pig food'
-const projectLine1 = 'Digging up a ton of potatoes'
-const projectLine2 = 'Peeling all the potatoes'
+const projectDescription = 'Pig food'
+const projectLine1 = 'Get potatoes'
+const projectLine2 = 'Peel potatoes'
+const quotationDate = '2020-03-15'
+const invoiceDate = '2020-04-15'
before(() => cy
.visitPage(clientUri)
@@ -91,9 +96,59 @@ describe('project', () => {
.get('@totalIncVAT').should('have.text', (400*1.21 + 700*1.06).toFixed(2))
)
- // it('should have quotation tab selected without invoices', () => cy
- //
- // )
+ it('should have quotation tab selected without invoices', () => cy
+ .get('[data-cy=tabInvoices]').should('not.exist')
+ .get('@tabQuotation').should('be.visible')
+ .get('@tabs').find('nav button:contains(invoices)').click()
+ .get('[data-cy=tabInvoices]').should('be.visible')
+ .get('@tabs').find('nav button:contains(quotation)').click()
+ )
+
+ it('should able to create a quotation', () => cy
+ .get('@tabQuotation').find('label:contains(date) input').first()
+ .type(quotationDate)
+ .tab().type(quotationDate)
+ .tab().type('14')
+ .tab().type(projectDescription)
+ .tab().type('Here is the quotation')
+ .get('@tabQuotation').find('label:contains(text after) input').first()
+ .type('Kind regards etc')
+ .get('@save').click()
+ .get('@showQuotation').click()
+ .expectPathname(projectUriQuotation)
+ .get(`:contains(${projectDescription})`)
+ .go('back')
+ )
+
+ it('should be able to add invoices', () => cy
+ .get('@tabs').find('nav button:contains(invoices)').click()
+ .asAll()
+ .get('@tabInvoices').should('be.visible')
+ .get('@invoices').find('li').should('have.length', 0)
+ .get('@addInvoice').click()
+ .get('@save').click()
+ .get('@invoices').find('li').should('have.length', 1)
+ .find('a:contains(invoice)').click()
+ .expectPathname(projectUriInvoice)
+ .go('back')
+ )
+
+ it('should be able to add reminder', () => cy
+ .get('@addInvoice').click()
+ .get('@save').click()
+ .get('@invoices').find('li').should('have.length', 2)
+ .find('a:contains(reminder)').click()
+ .expectPathname(projectUriReminder)
+ .go('back')
+ )
+
+ it('should be able set invoice date', () => cy
+ .get('@invoices').find('li').first().find('button').last().click()
+ .get('[data-cy=dialog]').find('input').first().type(invoiceDate)
+ .get('[data-cy=dialog]').find('button:contains(ok)').click()
+ .get('@save').click()
+ .get('@invoices').find('li').first().find(`div:contains(${invoiceDate})`).should('exist')
+ )
})
\ No newline at end of file