Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolving Eslint Errors #634

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from
2 changes: 2 additions & 0 deletions docker/dev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ COPY --chown=$USERNAME:$USERNAME ./terminalrc ./.config/xfce4/terminal/terminalr
RUN chmod +x .fd2/startup.bash \
&& chmod +x .fd2/panel.bash \
&& chmod +x .config/autostart/panel.desktop
# .eslintignore is used to ignore the fd2test directory when linting.
COPY ./eslintignore /home/$USERNAME/fd2test/.eslintignore

# Set permissions on the test directory in the container so that the fd2grp
# is able to read and write them.
Expand Down
1 change: 1 addition & 0 deletions docker/dev/eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"**/*.js
3 changes: 3 additions & 0 deletions farmdata2/cypress/support/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ import '/home/fd2dev/fd2test/farmdata2/farmdata2_modules/resources/fd2.css'
// Import Bootstrap style sheet
import 'bootstrap/dist/css/bootstrap.css'

// Import Bootstrap-Vue style sheet
import 'bootstrap-vue/dist/bootstrap-vue.css'

// Alternatively you can use CommonJS syntax:
// require('./commands')

Expand Down
60 changes: 60 additions & 0 deletions farmdata2/farmdata2_modules/resources/BCalendarDateSelection.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
const { BCalendar } = require('bootstrap-vue')
let BCalendarDateSelection = {
template: `
<span>
<slot></slot>
<bcalendar data-cy='date-select'
locale="en-US"></bcalendar>
</span>`,
props: {
dateValue: {
type: String,
required: true,
}
},
data(){
return {
selectedDate: this.dateValue,
}
},
component: {
'bcalendar': BCalendar,
},
}

try {
module.exports = {
BCalendarDateSelection
}
}
catch {}

// import Vue from 'vue';
// import { BCalendar } from 'bootstrap-vue';
// import 'bootstrap/dist/css/bootstrap.css';
// import 'bootstrap-vue/dist/bootstrap-vue.css';

// const CalendarComponent = Vue.component('calendar-component', {
// components: {
// BCalendar,
// },
// data() {
// return {
// selectedDate: null,
// locale: 'en', // set the locale to English
// };
// },
// template: `
// <div>
// <h2>Select a date:</h2>
// <b-calendar v-model="selectedDate" :locale="locale"></b-calendar>
// <p>You selected: {{ selectedDate }}</p>
// </div>
// `,
// });
// try {
// module.exports = {
// CalendarComponent
// }
// }
// catch {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { mount } from '@cypress/vue2'
import { shallowMount } from '@vue/test-utils'
import { BCalendar } from 'bootstrap-vue'

var BCalendarComp = require("./BCalendarDateSelection.js")
var BCalendarDateSelection = BCalendarComp.BCalendarDateSelection

describe('BCalendarDateSelection', () => {
it('renders a BootstrapVue calendar', () => {
const wrapper = mount(BCalendar, {
propsData: {
locale: 'en'
},
stubs: {
// If you're using a custom input component with BCalendar, you may need to stub it out here
}
})
// const wrapper = mount(BCalendarDateSelection, {

// })

cy.get('[data-cy=date-select]')
.should('exist')

cy.get('[data-cy=date-select]')
.should('be.visible')

})
})
34 changes: 17 additions & 17 deletions farmdata2/test_runner.bash
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@ fi

if [[ "$1" != "e2e" && "$1" != "ct" && "$1" != "all" ]];
then
echo "Usage: test_runner.bash [<type> [<args>]]"
echo " Run the Cypress test suite."
echo " <type>:"
echo " If no <type> is provided the Cypress GUI test runner will be opened."
echo " If <type> is provided the terminal-based Cypress test runner is used:"
echo " e2e - to run the end to end tests headless (*.spec.js)."
echo " ct - to run the component tests headless (*.spec.comp.js)."
echo " all - to run both the end-to-end and component tests in sequence."
echo " <args>:"
echo " Ignored if no <type> is provided."
echo " Otherwise, all remaining <args> are passed directly to cypress run."
echo " Several useful <args> include:"
echo " --browser <electron | firefox | chrome | chromium | ...>"
echo " --spec <blob>"
echo " e.g. --spec \"**/fd2_example/ui/*.spec.js\""
echo " e.g. --spec \"**/fd2_field_kit/**/*.spec.js\""
exit -1
echo "Usage: test_runner.bash [<type> [<args>]]"
echo " Run the Cypress test suite."
echo " <type>:"
echo " If no <type> is provided the Cypress GUI test runner will be opened."
echo " If <type> is provided the terminal-based Cypress test runner is used:"
echo " e2e - to run the end to end tests headless (*.spec.js)."
echo " ct - to run the component tests headless (*.spec.comp.js)."
echo " all - to run both the end-to-end and component tests in sequence."
echo " <args>:"
echo " Ignored if no <type> is provided."
echo " Otherwise, all remaining <args> are passed directly to cypress run."
echo " Several useful <args> include:"
echo " --browser <electron | firefox | chrome | chromium | ...>"
echo " --spec <blob>"
echo " e.g. --spec \"**/fd2_example/ui/*.spec.js\""
echo " e.g. --spec \"**/fd2_field_kit/**/*.spec.js\""
exit -1
fi

ARGS=${@:2}
Expand Down