-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13553 from bmeurant/master
[FEATURE ember-runtime-enumerable-includes] Implements Array.includes and deprecates Array.contains
- Loading branch information
Showing
13 changed files
with
283 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import {SuiteModuleBuilder} from 'ember-runtime/tests/suites/suite'; | ||
|
||
var suite = SuiteModuleBuilder.create(); | ||
|
||
suite.module('includes'); | ||
|
||
suite.test('includes returns correct value if startAt is positive', function() { | ||
var data = this.newFixture(3); | ||
var obj = this.newObject(data); | ||
|
||
equal(obj.includes(data[1], 1), true, 'should return true if included'); | ||
equal(obj.includes(data[0], 1), false, 'should return false if not included'); | ||
}); | ||
|
||
suite.test('includes returns correct value if startAt is negative', function() { | ||
var data = this.newFixture(3); | ||
var obj = this.newObject(data); | ||
|
||
equal(obj.includes(data[1], -2), true, 'should return true if included'); | ||
equal(obj.includes(data[0], -2), false, 'should return false if not included'); | ||
}); | ||
|
||
suite.test('includes returns true if startAt + length is still negative', function() { | ||
var data = this.newFixture(1); | ||
var obj = this.newObject(data); | ||
|
||
equal(obj.includes(data[0], -2), true, 'should return true if included'); | ||
equal(obj.includes(this.newFixture(1), -2), false, 'should return false if not included'); | ||
}); | ||
|
||
suite.test('includes returns false if startAt out of bounds', function() { | ||
var data = this.newFixture(1); | ||
var obj = this.newObject(data); | ||
|
||
equal(obj.includes(data[0], 2), false, 'should return false if startAt >= length'); | ||
equal(obj.includes(this.newFixture(1), 2), false, 'should return false if startAt >= length'); | ||
}); | ||
|
||
export default suite; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.