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
Deprecate setContext #448
Merged
Merged
Deprecate setContext #448
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,42 @@ | ||
import { moduleForComponent, test } from 'ember-qunit'; | ||
import { module, test } from 'ember-qunit'; | ||
import { setupTest } from 'ember-qunit'; | ||
|
||
import { create, collection } from 'ember-cli-page-object'; | ||
|
||
moduleForComponent('calculating-device', 'Deprecation | legacy collection', { | ||
integration: true | ||
}); | ||
import require from 'require'; | ||
if (require.has('@ember/test-helpers')) { | ||
module('Deprecation | legacy collection', function(hooks) { | ||
setupTest(hooks); | ||
|
||
test('shows deprecation warning when first parameter is not a string', function(assert) { | ||
let page = create({ | ||
foo: collection({ | ||
itemScope: 'li' | ||
}) | ||
}); | ||
test('shows deprecation warning when first parameter is not a string', function(assert) { | ||
let page = create({ | ||
foo: collection({ | ||
itemScope: 'li' | ||
}) | ||
}); | ||
|
||
page.foo(); | ||
page.foo(); | ||
|
||
assert.expectDeprecation('You are currently using the legacy collection API, check the documentation to see how to upgrade to the new API.'); | ||
}); | ||
assert.expectDeprecation('You are currently using the legacy collection API, check the documentation to see how to upgrade to the new API.'); | ||
}); | ||
|
||
test("doesn't show a deprecation warning when first parameter is a string", function(assert) { | ||
let page = create({ | ||
foo: collection('foo') | ||
}); | ||
test("doesn't show a deprecation warning when first parameter is a string", function(assert) { | ||
let page = create({ | ||
foo: collection('foo') | ||
}); | ||
|
||
page.foo; | ||
page.foo; | ||
|
||
assert.expectNoDeprecation(); | ||
}); | ||
assert.expectNoDeprecation(); | ||
}); | ||
|
||
test('shows a warning on invalid legacy collection definitions', function(assert) { | ||
assert.expectWarning(function() { | ||
create({ | ||
foo: collection({ | ||
}) | ||
test('shows a warning on invalid legacy collection definitions', function(assert) { | ||
assert.expectWarning(function() { | ||
create({ | ||
foo: collection({ | ||
}) | ||
}); | ||
}, 'Legacy page object collection definition is invalid. Please, make sure you include a `itemScope` selector.'); | ||
}); | ||
}, 'Legacy page object collection definition is invalid. Please, make sure you include a `itemScope` selector.'); | ||
}); | ||
}); | ||
} |
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,23 @@ | ||
import { module, test } from 'qunit'; | ||
import { create } from 'ember-cli-page-object'; | ||
import require from 'require'; | ||
|
||
if (require.has('@ember/test-helpers')) { | ||
const DEPRECATION_MESSAGE = 'setContext() is deprecated. Please make sure you use "@ember/test-helpers" of v1 or higher.'; | ||
|
||
module('Deprecation | setContext', function() { | ||
test('passing page context to create is deprecated', function(assert) { | ||
this.page = create().setContext(this); | ||
|
||
assert.expectDeprecation(DEPRECATION_MESSAGE) | ||
}); | ||
|
||
test('passing page context to create is deprecated', function(assert) { | ||
this.page = create({ | ||
context: this | ||
}); | ||
|
||
assert.expectDeprecation(DEPRECATION_MESSAGE) | ||
}); | ||
}); | ||
} |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs coverage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unfortunatelly, in added test, there are some
require.unsee
conflicts with https://github.com/san650/ember-cli-page-object/blob/master/tests/unit/-private/compatibility-test.js, which I could not figure out.Removing a new test :(