-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Assert that readOnly isn't called over CPs with setter #10761
Assert that readOnly isn't called over CPs with setter #10761
Conversation
@@ -900,6 +900,16 @@ QUnit.test('is chainable', function() { | |||
ok(cp instanceof ComputedProperty); | |||
}); | |||
|
|||
QUnit.test('throws assertion if called over a CP with a setter', function() { | |||
throws(function() { |
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 to use expectAssertion (because prod build tests will not throw since asserts are removed from prod builds).
39f3564
to
5b74634
Compare
set: function() { } | ||
}).readOnly(); | ||
}, /Computed properties that define a setter cannot be read-only/); | ||
ok(true, 'No errors were thrown'); |
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.
This seems ok, but I don't understand what it is for...
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.
The last ok
? I've seen similar lines in other tests related to assertions, but I agree that is redundant. Gone
5b74634
to
1eeb925
Compare
…rties_with_setter Assert that readOnly isn't called over CPs with setter
Thank you! |
This should not generate an exception, as this is a breaking change that causes apps that happened to have an extra unused argument in their CP functions to break. We can deprecate it in 1.x and cause it to raise in 2.x. |
I haven't considered that, you're right, it's beaking. |
In preparation for emberjs/rfcs#12
Ensure that an error is thrown is
readOnly
is invoked over CP's that defines a setter function. It is conceptually absurd.