Skip to content

Commit

Permalink
Merge branch 'funfun2' into improve-browser-tests
Browse files Browse the repository at this point in the history
# Conflicts:
#	test/functional/dd-feedback-spec.js
#	test/functional/dd-functional-settlement-spec.js
#	test/functional/dd-school-data-spec.js
#	test/functional/settlementAidOfferPage.js
  • Loading branch information
marteki committed Aug 10, 2016
2 parents 8882770 + b2b5d20 commit 71aa8cb
Show file tree
Hide file tree
Showing 10 changed files with 153 additions and 53 deletions.
37 changes: 33 additions & 4 deletions .snyk
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,20 @@ patch:
'npm:minimatch:20160620':
- capital-framework > npmi > npm > glob > minimatch:
patched: '2016-06-29T16:28:08.447Z'
student-debt-calc > istanbul > fileset > minimatch:
patched: '2016-08-04T15:51:44.067Z'
glob-all > glob > minimatch:
patched: '2016-08-09T00:11:35.413Z'
- capital-framework > npmi > npm > init-package-json > glob > minimatch:
patched: '2016-06-29T16:28:08.447Z'
student-debt-calc > istanbul > fileset > glob > minimatch:
patched: '2016-08-04T15:51:44.067Z'
browser-sync > resp-modifier > minimatch:
patched: '2016-08-09T00:11:35.413Z'
- capital-framework > npmi > npm > read-package-json > glob > minimatch:
patched: '2016-06-29T16:28:08.447Z'
protractor > jasmine > glob > minimatch:
patched: '2016-08-09T00:11:35.413Z'
- capital-framework > npmi > npm > init-package-json > read-package-json > glob > minimatch:
patched: '2016-06-29T16:28:08.447Z'
jasmine > glob > minimatch:
patched: '2016-08-09T00:11:35.413Z'
- capital-framework > npmi > npm > read-installed > read-package-json > glob > minimatch:
patched: '2016-06-29T16:28:08.447Z'
- capital-framework > npmi > npm > minimatch:
Expand Down Expand Up @@ -96,12 +100,37 @@ patch:
patched: '2016-07-25T15:16:02.601Z'
- student-debt-calc > fileset > minimatch:
patched: '2016-07-25T15:16:02.601Z'
- student-debt-calc > istanbul > fileset > minimatch:
patched: '2016-08-04T15:51:44.067Z'
- student-debt-calc > istanbul > fileset > glob > minimatch:
patched: '2016-08-04T15:51:44.067Z'
'npm:tough-cookie:20160722':
- capital-framework > npmi > npm > npm-registry-client > request > tough-cookie:
patched: '2016-07-25T15:16:02.601Z'
browser-sync > chokidar > fsevents > node-pre-gyp > request > tough-cookie:
patched: '2016-08-09T00:11:35.413Z'
- capital-framework > npmi > npm > request > tough-cookie:
patched: '2016-07-25T15:16:02.601Z'
browser-sync > localtunnel > request > tough-cookie:
patched: '2016-08-09T00:11:35.413Z'
- capital-framework > npmi > npm > node-gyp > request > tough-cookie:
patched: '2016-07-25T15:16:02.601Z'
- student-debt-calc > request > tough-cookie:
patched: '2016-07-25T15:16:02.601Z'
'npm:negotiator:20160616':
- browser-sync > socket.io > engine.io > accepts > negotiator:
patched: '2016-08-09T00:11:35.413Z'
- browser-sync > serve-index > accepts > negotiator:
patched: '2016-08-09T00:11:35.413Z'
- accepts > negotiator:
patched: '2016-08-09T00:11:35.413Z'
'npm:request:20160119':
- browser-sync > localtunnel > request:
patched: '2016-08-09T00:11:35.413Z'
'npm:ws:20160624':
- browser-sync > socket.io > socket.io-client > engine.io-client > ws:
patched: '2016-08-09T00:11:35.413Z'
- protractor > selenium-webdriver > ws:
patched: '2016-08-09T00:11:35.413Z'
- browser-sync > socket.io > engine.io > ws:
patched: '2016-08-09T00:11:35.413Z'
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
All notable changes to this project will be documented in this file.
We follow the [Semantic Versioning 2.0.0](http://semver.org/) format.

## 2.1.8
- fixed GradPlus and over-borrowing calculations
- student-debt-calc bumped to v. 2.6.0

## 2.1.7
- Added security updates
- Fixed reporting of Perkins loan caps
Expand Down
39 changes: 15 additions & 24 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "college-costs",
"version": "2.1.7",
"version": "2.1.8",
"description": "Tools to help students make informed financial decisions about college.",
"homepage": "http://www.github.com/cfpb/college-costs/",
"author": {
Expand Down Expand Up @@ -64,7 +64,7 @@
"require-dir": "0.3.0",
"snyk": "1.18.0",
"sticky-kit": "1.1.3",
"student-debt-calc": "2.5.11"
"student-debt-calc": "2.6.0"
},
"snyk": true
}
2 changes: 1 addition & 1 deletion paying_for_college/templates/worksheet.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<span class="u-visually-hidden">Menu</span></a>
{% endblock %}
{% block content %}
<main data-context="{{url_root}}">
<main id="main" data-context="{{url_root}}">
<div class="understanding-financial-aid-offer">
<section class="content_hero hero hero__intro">
<div class="hero_wrapper wrapper">
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def run(self):

setup(
name='college-costs',
version='2.1.7',
version='2.1.8',
author='CFPB',
author_email='tech@cfpb.gov',
maintainer='cfpb',
Expand Down
1 change: 0 additions & 1 deletion src/disclosures/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ var app = {
publish.financialData( 'totalCost', null );
}
financialView.updateViewWithURL( schoolValues, urlValues );

// initialize metric view
metricView.init();
financialView.updateView( getFinancial.values() );
Expand Down
8 changes: 5 additions & 3 deletions src/disclosures/js/models/financial-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,14 @@ var financialModel = {
recalcOverborrowing: function() {
var model = this.values,
overBorrow = 0;
if ( model.yearOneCosts < model.grantsSavingsTotal + model.borrowingTotal ) {
if ( model.costOfAttendance < model.grantsSavingsTotal + model.borrowingTotal ) {
overBorrow = model.borrowingTotal +
model.grantsSavingsTotal -
model.costOfAttendance;
if ( overBorrow > model.borrowingTotal ) {
overBorrow = model.borrowingTotal;
if ( overBorrow > 0 && model.borrowingTotal > 0 ) {
overBorrow = Math.min( overBorrow, model.borrowingTotal );
} else {
overBorrow = 0;
}
}
return overBorrow;
Expand Down
8 changes: 6 additions & 2 deletions src/disclosures/js/views/financial-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ var financialView = {
this.resetPrivateLoanView();
this.continueStep2Listener();
this.termToggleListener();
$( 'main' ).data( 'getFinancial', getFinancial );
},

/**
Expand Down Expand Up @@ -237,14 +238,17 @@ var financialView = {
* that is based on the remaining cost
*/
updateRemainingCostContent: function() {
var gap = Math.round( getFinancial.values().gap ),
var model = getFinancial.values(),
gap = Math.round( model.gap ),
overborrowing = Math.round( model.overborrowing ),
positiveRemainingCost = $( '.offer-part_content-positive-cost' ),
negativeRemainingCost = $( '.offer-part_content-negative-cost' );
positiveRemainingCost.hide();
negativeRemainingCost.hide();

if ( gap > 0 ) {
positiveRemainingCost.show();
} else if ( gap < 0 ) {
} else if ( overborrowing > 0 ) {
var $span = negativeRemainingCost.find( '[data-financial="gap"]' );
$span.text( $span.text().replace( '-', '' ) );
negativeRemainingCost.show();
Expand Down
101 changes: 86 additions & 15 deletions test/functional/dd-functional-settlement-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,30 @@

var SettlementPage = require( './settlementAidOfferPage.js' );

function getFinancial( prop ) {
var script = "$( 'main' ).attr( 'data-test', $( 'main' ).data().getFinancial.values()." +
prop + " );";
browser.executeScript( script );
return $( '#main' ).getAttribute( 'data-test').then( function( attr) {
return attr;
} );
}

function cleanNumber( string ) {
return string.replace( /[^0-9\.]+/g, '' );
}

function waitForNumbers( page ) {
return browser.wait(
function() {
return page.totalCostOfAttendance.getText().then(
function( text ) {
return text !== 'Updating...' && text !== '0';
} );
}
)
}

fdescribe( 'A dynamic financial aid disclosure that\'s required by settlement', function() {
var page;
var EC = protractor.ExpectedConditions;
Expand Down Expand Up @@ -92,34 +116,81 @@ fdescribe( 'A dynamic financial aid disclosure that\'s required by settlement',
// Remaining cost (before loans): $14,026
// Remaining cost (after loans): -$474

// it( 'should display the correct name for the college', function() {
// page.confirmVerification();
// expect( page.schoolName.getText() ).toEqual( 'Brown Mackie College-Fort Wayne' );
// } );

it( 'should display the correct name for the college', function() {
page.confirmVerification();
expect( page.schoolName.getText() ).toEqual( 'The Art Institute of Houston' );
getFinancial( 'school' ).then( function( attr ) {
expect( page.schoolName.getText() ).toEqual( attr );
} );
} );

it( 'should let a student edit the tuition and fees', function() {
page.confirmVerification();
expect( page.tuitionFeesCosts.isEnabled() ).toEqual( true );
} );

// it( 'should show correct totals on load', function() {
// page.confirmVerification();
// expect( page.totalCostOfAttendance.getText() ).toEqual( '43,626' );
// expect( page.studentTotalCost.getText() ).toEqual( '32,026' );
// expect( page.remainingCostFinal.getText() ).toEqual( '2,526' );
// } );

it( 'should show correct totals on load', function() {
page.confirmVerification();
expect( page.totalCostOfAttendance.getText() ).toEqual( '43,626' );
expect( page.studentTotalCost.getText() ).toEqual( '32,026' );
expect( page.remainingCostFinal.getText() ).toEqual( '2,526' );
waitForNumbers( page )
.then(
function() {
page.totalCostOfAttendance.getText().then( function( attr ) {
attr = cleanNumber( attr );
expect( getFinancial( 'costOfAttendance' ) ).toEqual( attr );
} );
page.studentTotalCost.getText().then( function( attr ) {
attr = cleanNumber( attr );
expect( getFinancial( 'firstYearNetCost' ) ).toEqual( attr );
} );
page.remainingCostFinal.getText().then( function( attr ) {
attr = cleanNumber( attr );
expect( getFinancial( 'gap' ) ).toEqual( attr );
} );
}
);
} );

it( 'should properly update when the tuition and fees are modified', function() {
page.confirmVerification();
browser.wait(
page.setTuitionFeesCosts( 48976 ).then(
function() {
expect( page.totalCostOfAttendance.getText() ).toEqual( '53,626' );
expect( page.studentTotalCost.getText() ).toEqual( '42,026' );
expect( page.remainingCostFinal.getText() ).toEqual( '12,526' );
}
), 10000
);
fit( 'should properly update when the tuition and fees are modified', function() {
page.confirmVerification();

waitForNumbers( page )
.then(
function() {
page.totalCostOfAttendance.getText().then( function( attr ) {
attr = cleanNumber( attr );
expect( getFinancial( 'costOfAttendance' ) ).toEqual( attr );
} );
page.studentTotalCost.getText().then( function( attr ) {
attr = cleanNumber( attr );
expect( getFinancial( 'firstYearNetCost' ) ).toEqual( attr );
} );
page.remainingCostFinal.getText().then( function( attr ) {
attr = cleanNumber( attr );
expect( getFinancial( 'gap' ) ).toEqual( attr );
} );
} );

// browser.wait(
// page.setTuitionFeesCosts( 48976 ).then(
// function() {
// browser.sleep(500);
// expect( page.totalCostOfAttendance.getText() ).toEqual( '53,626' );
// expect( page.studentTotalCost.getText() ).toEqual( '42,026' );
// expect( page.remainingCostFinal.getText() ).toEqual( '12,526' );
// }
// ), 10000
// );
} );

it( 'should properly update when the housing and meals are modified', function() {
Expand Down

0 comments on commit 71aa8cb

Please sign in to comment.