Skip to content

Fix test that did not tested much #41

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

Merged
merged 1 commit into from
Jun 10, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 10 additions & 36 deletions tests/lib/globeCoordinate/globeCoordinate.Formatter.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,49 +51,23 @@ define( [
} );

QUnit.test( 'precisionText()', function( assert ) {
var c,
precisions = {
1: 1,
0.016666666666666666: 1 / 60,
2.7777777777777776e-7: 1 / 3600000,
var precisions = {
1: 'to a degree',
0.016666666666666666: 'to an arcminute',
2.7777777777777776e-7: 'to 1/1000 of an arcsecond',
10: '±10°'
},
formatter = new Formatter();

$.each( precisions, function( testPrecision, expected ) {
c = new GlobeCoordinate(
{ latitude: 1, longitude: 1, precision: testPrecision }
);

var precisionText = Formatter.PRECISIONTEXT( testPrecision );
var precisionText = formatter.precisionText( testPrecision );

// Look up precision text:
if( typeof expected === 'number' ) {

$.each( [ 10, 1, 1 / 60, 1 / 3600000 ], function( i, precision ) {
if( '' + precision === testPrecision ) {

assert.strictEqual(
precisionText,
formatter.precisionText( c.getPrecision() ),
'Precision text for \'' + precision + '\' results in text \''
+ precisionText + '\'.'
);

return false;
}
} );

} else {

assert.strictEqual(
precisionText,
expected,
'Precision text for \'' + testPrecision + '\' results in text \'' + expected + '\'.'
);

}

assert.strictEqual(
precisionText,
expected,
'Precision text for \'' + testPrecision + '\' results in text \'' + expected + '\'.'
);
} );

} );
Expand Down