Step 2: Check the JavaScript
As we saw earlier, there are two JavaScript files Dave’s page needs to run: EmployeeModel and EmployeeController. Let’s take a look at the model first.
| var EmployeeModel = function(){ |
| |
| function getOnsite(){ |
| var selectedArray = []; |
| $.each($('#Onsite option'),function(key,option) { |
| selectedArray[selectedArray.length] = $(option).val();}) |
| |
| return selectedArray; |
| } |
| |
| function getOffsite(){ |
| var selectedArray = []; |
| $.each($('#Offsite option'),function(key,option) { |
| selectedArray[selectedArray.length] = $(option).val();}) |
| |
| return selectedArray; |
| } |
| |
| function getOnsiteIsEmpty(){ |
| var selectedArray = []; |
| $.each($('#Onsite option'), ... |
Get The Way of the Web Tester now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.