Skip to content

feat #80 bindable width and height for containers #347

Closed
wants to merge 1 commit into from

2 participants

@jakub-g
Aria Templates member
jakub-g commented Jan 23, 2013

Adds possibility to bind width and height for some of container-based widgets (Div, Dialog, Fieldset, TabPanel). The bound size is a subject to min/max size constraints for all of those widgets.

This commit lifts the requirement for widgets to have width/height = -1 for min/max width/height to work. So this is backward-incompatible change in some way, but the behavior of width & maxwidth etc. when provided
together was undefined earlier, so it should not have relied upon by anyone.

Close #80.

@divdavem divdavem was assigned Jan 28, 2013
@divdavem divdavem commented on the diff Jan 28, 2013
src/aria/widgets/container/Container.js
if (this._changedContainerSize) {
- domElt.style.width = cfg.width > -1 ? cfg.width + "px" : "";
- domElt.style.height = cfg.height > -1 ? cfg.height + "px" : "";
- if (this._frame) {
- this._frame.resize(cfg.width, cfg.height);
+ var constrainedWidth = aria.utils.Math.normalize(cfg.width, widthConf.min, widthConf.max);
+ var constrainedHeight = aria.utils.Math.normalize(cfg.height, heightConf.min, heightConf.max);
@divdavem
Aria Templates member
divdavem added a note Jan 28, 2013

aria.utils.Math should be added as a dependency of this class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@divdavem divdavem commented on an outdated diff Jan 28, 2013
test/aria/widgets/container/issue80/DivTest.js
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Test case for aria.widgets.container.Dialog
+ */
@divdavem
Aria Templates member
divdavem added a note Jan 28, 2013

Is this really a test case for the Dialog? (or was that comment forgotten after a copy/paste?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@divdavem divdavem commented on an outdated diff Jan 28, 2013
test/aria/widgets/container/issue80/FieldsetTest.js
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Test case for aria.widgets.container.Dialog
+ */
@divdavem
Aria Templates member
divdavem added a note Jan 28, 2013

Is this really a test case for the Dialog? (or was that comment forgotten after a copy/paste?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@divdavem divdavem commented on an outdated diff Jan 28, 2013
test/aria/widgets/container/issue80/TabpanelTest.js
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Test case for aria.widgets.container.Dialog
+ */
@divdavem
Aria Templates member
divdavem added a note Jan 28, 2013

Is this really a test case for the Dialog? (or was that comment forgotten after a copy/paste?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@divdavem divdavem commented on an outdated diff Jan 28, 2013
...gets/container/issue80/shared/BindableSizeTestCase.js
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Test case for aria.widgets.container.Dialog
+ */
@divdavem
Aria Templates member
divdavem added a note Jan 28, 2013

Isn't this more general than a test case for the Dialog?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@jakub-g jakub-g feat #80 bindable width and height for containers
Adds possibility to bind width and height for some of container-based
widgets (Div, Dialog, Fieldset, TabPanel). The bound size is a subject to
min/max size constraints for all of those widgets.

This commit lifts the requirement for widgets to have width/height = -1
for min/max width/height to work. So this is backward-incompatible change
in some way, but the behavior of width & maxwidth etc. when provided
together was undefined earlier, so it should not have relied upon by anyone.

Apart from the bindable width/height tests, this commit brings also
a test case on static height constraints of the Dialog widget and their
behavior when the contents od the Dialog change due to a refresh.

Close #80. Close #347.
0481664
@divdavem divdavem added a commit that closed this pull request Jan 28, 2013
@jakub-g jakub-g feat #80 bindable width and height for containers
Adds possibility to bind width and height for some of container-based
widgets (Div, Dialog, Fieldset, TabPanel). The bound size is a subject to
min/max size constraints for all of those widgets.

This commit lifts the requirement for widgets to have width/height = -1
for min/max width/height to work. So this is backward-incompatible change
in some way, but the behavior of width & maxwidth etc. when provided
together was undefined earlier, so it should not have relied upon by anyone.

Apart from the bindable width/height tests, this commit brings also
a test case on static height constraints of the Dialog widget and their
behavior when the contents od the Dialog change due to a refresh.

Close #80. Close #347.
d93ea66
@divdavem divdavem closed this in d93ea66 Jan 28, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.