def _check_reset_translation_select(
- self, client, checkbox, singular_select, singular_current,
- plural_select=None):
+ self, client, checkbox, singular_new_select, singular_current_select,
+ singular_new_field=None, plural_new_select=None):
"""Checks that the new translation select radio buttons are checked
when ticking 'Someone should review this translation' checkbox.
"""
@@ -61,44 +61,61 @@ client.waits.forElement( id=checkbox, timeout=constants.FOR_ELEMENT) client.waits.forElement(
- id=singular_select, timeout=constants.FOR_ELEMENT)
- if plural_select is not None:
- client.waits.forElement(
- id=plural_select, timeout=constants.FOR_ELEMENT)
+ id=singular_new_select, timeout=constants.FOR_ELEMENT)
+ client.waits.forElement(
+ id=singular_current_select, timeout=constants.FOR_ELEMENT)
+ if plural_new_select is not None:
+ client.waits.forElement(
+ id=plural_new_select, timeout=constants.FOR_ELEMENT)
+ if singular_new_field is not None:
+ client.waits.forElement(
+ id=singular_new_field, timeout=constants.FOR_ELEMENT)
# Check that initialy the checkbox is not checked and
# that the radio buttons are not selected. client.asserts.assertNotChecked(id=checkbox)
- client.asserts.assertNotChecked(id=singular_select)
- client.asserts.assertChecked(id=singular_current)
- if plural_select is not None:
- client.asserts.assertNotChecked(id=plural_select)
+ client.asserts.assertNotChecked(id=singular_new_select)
+ client.asserts.assertChecked(id=singular_current_select)
+ if plural_new_select is not None:
+ client.asserts.assertNotChecked(id=plural_new_select)
# Check the checkbox client.click(id=checkbox)
-
+
# Check that the checkbox and the new translation radio buttons are
# selected. client.asserts.assertChecked(id=checkbox)
- client.asserts.assertChecked(id=singular_select)
- client.asserts.assertNotChecked(id=singular_current)
- if plural_select is not None:
- client.asserts.assertChecked(id=plural_select)
-
- # We select the current translation for the singular form.
- client.click(id=singular_current)
+ client.asserts.assertChecked(id=singular_new_select)
+ client.asserts.assertNotChecked(id=singular_current_select)
+ if plural_new_select is not None:
+ client.asserts.assertChecked(id=plural_new_select)
# Then then we uncheck the 'Someone needs to review this translation'
# checkbox. client.click(id=checkbox)
# Unchecking the 'Someone needs to review this translation' checkbox
- # will not change the state of the radio buttons.
+ # when the 'New translation' field is empty, will select the current
+ # translation. client.asserts.assertNotChecked(id=checkbox)
- client.asserts.assertNotChecked(id=singular_select)
- client.asserts.assertChecked(id=singular_current)
- if plural_select is not None:
- client.asserts.assertChecked(id=plural_select)
+ client.asserts.assertNotChecked(id=singular_new_select)
+ client.asserts.assertChecked(id=singular_current_select)
+ if plural_new_select is not None:
+ client.asserts.assertNotChecked(id=plural_new_select)
+
+ if singular_new_field is not None:
+ # Checking again the 'Someone need to review this translation'
+ # checkbox, type some text and unchecking it should keep the new
+ # translation fields selected
+ client.click(id=checkbox)
+ client.type(text=u'some test', id=singular_new_field)
+ client.click(id=checkbox)
+
+ client.asserts.assertNotChecked(id=checkbox)
+ client.asserts.assertChecked(id=singular_new_select)
+ client.asserts.assertNotChecked(id=singular_current_select)
+ if plural_new_select is not None:
+ client.asserts.assertNotChecked(id=plural_new_select)
def test_pofile_reset_translation_select(self):
"""Test for automatically selecting new translation when
@@ -116,16 +133,18 @@ user.ensure_login(self.client)
checkbox = u'msgset_144_force_suggestion'
- singular_select = u'msgset_144_es_translation_0_new_select'
- singular_current = u'msgset_144_es_translation_0_radiobutton'
- plural_select = u'msgset_144_es_translation_1_new_select'
+ singular_new_select = u'msgset_144_es_translation_0_new_select'
+ singular_new_field = u'msgset_144_es_translation_0_new'
+ singular_current_select = u'msgset_144_es_translation_0_radiobutton'
+ plural_new_select = u'msgset_144_es_translation_1_new_select' self._check_reset_translation_select( client, checkbox=checkbox,
- singular_select=singular_select,
- singular_current=singular_current,
- plural_select=plural_select)
-
+ singular_new_select=singular_new_select,
+ singular_new_field=singular_new_field,
+ singular_current_select=singular_current_select,
+ plural_new_select=plural_new_select)
+
# Go to the zoom in page for a translation without plural forms. self.client.open(
url='http://translations.launchpad.dev:8085/'
@@ -135,13 +154,13 @@ user.ensure_login(self.client)
Hi Henning,
I'm back in business.
Here are the changes after applying your JS code and updating the windmill tests.
I have also merged with devel.
If everything is ok, can you please send this branch to ec2-test?
Thanks! launchpad/ javascript/ translations/ pofile. js' launchpad/ javascript/ translations/ pofile. js 2010-03-23 00:22:40 +0000 launchpad/ javascript/ translations/ pofile. js 2010-04-11 23:07:06 +0000
return; 'checked' ) == true) {
var select = Y.one('#' + translation_id + '_select');
if (select !== null) {
select. set('checked' , true);
} get('value' ) == '') { id.replace( radio.set( 'checked' , true);
=== modified file 'lib/canonical/
--- lib/canonical/
+++ lib/canonical/
@@ -374,10 +374,25 @@
}
if (this.get(
+ // When checking the "Need review" checkbox the new
+ // translation should be automatically checked.
+ } else {
+ // When unchecking the "Need review" checkbox and the new
+ // translation is empty, the current translation should be
+ // automatically selected.
+ var inputfield = Y.one('#' + translation_id);
+ if (inputfield !== null && inputfield.
+ var current_radio_id = translation_
+ /_new$/, '_radiobutton');
+ var current_radio = Y.one('#' + current_radio_id);
+ if (current_radio !== null) {
+ current_
+ }
+ }
}
},
node , node, fields[key]
=== modified file 'lib/lp/ translations/ windmill/ tests/test_ pofile_ translate. py' translations/ windmill/ tests/test_ pofile_ translate. py 2010-03-23 00:22:40 +0000 translations/ windmill/ tests/test_ pofile_ translate. py 2010-04-11 23:40:51 +0000
client. asserts. assertChecked( id=radiobutton_ id)
--- lib/lp/
+++ lib/lp/
@@ -52,8 +52,8 @@
def _check_ reset_translati on_select( select= None): new_select, singular_ current_ select, new_field= None, plural_ new_select= None):
client. waits.forElemen t(
id= checkbox, timeout= constants. FOR_ELEMENT)
client. waits.forElemen t( constants. FOR_ELEMENT) waits.forElemen t( constants. FOR_ELEMENT) new_select, timeout= constants. FOR_ELEMENT) waits.forElemen t( current_ select, timeout= constants. FOR_ELEMENT) waits.forElemen t( new_select, timeout= constants. FOR_ELEMENT) waits.forElemen t( new_field, timeout= constants. FOR_ELEMENT)
- self, client, checkbox, singular_select, singular_current,
- plural_
+ self, client, checkbox, singular_
+ singular_
"""Checks that the new translation select radio buttons are checked
when ticking 'Someone should review this translation' checkbox.
"""
@@ -61,44 +61,61 @@
- id=singular_select, timeout=
- if plural_select is not None:
- client.
- id=plural_select, timeout=
+ id=singular_
+ client.
+ id=singular_
+ if plural_new_select is not None:
+ client.
+ id=plural_
+ if singular_new_field is not None:
+ client.
+ id=singular_
# Check that initialy the checkbox is not checked and
client. asserts. assertNotChecke d(id=checkbox) asserts. assertNotChecke d(id=singular_ select) asserts. assertChecked( id=singular_ current) asserts. assertNotChecke d(id=plural_ select) asserts. assertNotChecke d(id=singular_ new_select) asserts. assertChecked( id=singular_ current_ select) asserts. assertNotChecke d(id=plural_ new_select)
# that the radio buttons are not selected.
- client.
- client.
- if plural_select is not None:
- client.
+ client.
+ client.
+ if plural_new_select is not None:
+ client.
# Check the checkbox
client. click(id= checkbox)
client. asserts. assertChecked( id=checkbox) asserts. assertChecked( id=singular_ select) asserts. assertNotChecke d(id=singular_ current) asserts. assertChecked( id=plural_ select) click(id= singular_ current) asserts. assertChecked( id=singular_ new_select) asserts. assertNotChecke d(id=singular_ current_ select) asserts. assertChecked( id=plural_ new_select)
-
+
# Check that the checkbox and the new translation radio buttons are
# selected.
- client.
- client.
- if plural_select is not None:
- client.
-
- # We select the current translation for the singular form.
- client.
+ client.
+ client.
+ if plural_new_select is not None:
+ client.
# Then then we uncheck the 'Someone needs to review this translation'
client. click(id= checkbox)
# checkbox.
# Unchecking the 'Someone needs to review this translation' checkbox
client. asserts. assertNotChecke d(id=checkbox) asserts. assertNotChecke d(id=singular_ select) asserts. assertChecked( id=singular_ current) asserts. assertChecked( id=plural_ select) asserts. assertNotChecke d(id=singular_ new_select) asserts. assertChecked( id=singular_ current_ select) asserts. assertNotChecke d(id=plural_ new_select) click(id= checkbox) type(text= u'some test', id=singular_ new_field) click(id= checkbox) asserts. assertNotChecke d(id=checkbox) asserts. assertChecked( id=singular_ new_select) asserts. assertNotChecke d(id=singular_ current_ select) asserts. assertNotChecke d(id=plural_ new_select)
- # will not change the state of the radio buttons.
+ # when the 'New translation' field is empty, will select the current
+ # translation.
- client.
- client.
- if plural_select is not None:
- client.
+ client.
+ client.
+ if plural_new_select is not None:
+ client.
+
+ if singular_new_field is not None:
+ # Checking again the 'Someone need to review this translation'
+ # checkbox, type some text and unchecking it should keep the new
+ # translation fields selected
+ client.
+ client.
+ client.
+
+ client.
+ client.
+ client.
+ if plural_new_select is not None:
+ client.
def test_pofile_ reset_translati on_select( self):
user. ensure_ login(self. client)
"""Test for automatically selecting new translation when
@@ -116,16 +133,18 @@
checkbox = u'msgset_ 144_force_ suggestion' 144_es_ translation_ 0_new_select' 144_es_ translation_ 0_radiobutton' 144_es_ translation_ 1_new_select' 144_es_ translation_ 0_new_select' 144_es_ translation_ 0_new' current_ select = u'msgset_ 144_es_ translation_ 0_radiobutton' 144_es_ translation_ 1_new_select'
self. _check_ reset_translati on_select(
client,
checkbox= checkbox, select= singular_ select, current= singular_ current, select= plural_ select) new_select= singular_ new_select, new_field= singular_ new_field, current_ select= singular_ current_ select, new_select= plural_ new_select)
self. client. open( translations. launchpad. dev:8085/ '
user. ensure_ login(self. client)
- singular_select = u'msgset_
- singular_current = u'msgset_
- plural_select = u'msgset_
+ singular_new_select = u'msgset_
+ singular_new_field = u'msgset_
+ singular_
+ plural_new_select = u'msgset_
- singular_
- singular_
- plural_
-
+ singular_
+ singular_
+ singular_
+ plural_
+
# Go to the zoom in page for a translation without plural forms.
url='http://
@@ -135,13 +154,13 @@
checkbox = u'msgset_ 148_force_ suggestion' 148_es_ translation_ 0_new_select' 148_es_ translation_ 0_radiobutton' 148_es_ translation_ 0_new_select' current_ select = u'msgset_ 148_es_ translation_ 0_radiobutton'
self. _check_ reset_translati on_select(
client,
checkbox= checkbox, select= singular_ select, current= singular_ current) new_select= singular_ new_select, current_ select= singular_ current_ select)
- singular_select = u'msgset_
- singular_current = u'msgset_
+ singular_new_select = u'msgset_
+ singular_
- singular_
- singular_
+ singular_
+ singular_
# Go to the zoom out page for some translations.
self. client. open(
user. ensure_ login(self. client)
@@ -152,14 +171,14 @@
checkbox = u'msgset_ 130_force_ suggestion' 130_es_ translation_ 0_new_select' 130_es_ translation_ 0_radiobutton' 130_es_ translation_ 0_new_select' current_ select = u'msgset_ 130_es_ translation_ 0_radiobutton'
self. _check_ reset_translati on_select(
client,
checkbox= checkbox, select= singular_ select, current= singular_ current) new_select= singular_ new_select, current_ select= singular_ current_ select)
client. asserts. assertNotChecke d(
id= u'msgset_ 131_es_ translation_ 0_new_select' )
- singular_select = u'msgset_
- singular_current = u'msgset_
+ singular_new_select = u'msgset_
+ singular_
- singular_
- singular_
-
+ singular_
+ singular_
+
# Ensure that the other radio buttons are not changed