I have also added a test for pt_BR, since the use of „_” in language code and as a separator for form fields can generated errors.
I have removed „user.ensure_login(self.client)” and leave it only of the first page loaded in this test.
Do we really need to call it after each page load?
I have renamed the variables and remove the comment. Many thanks for this review!
=== modified file 'lib/canonical/launchpad/javascript/translations/pofile.js'
--- lib/canonical/launchpad/javascript/translations/pofile.js 2010-04-12 00:39:34 +0000
+++ lib/canonical/launchpad/javascript/translations/pofile.js 2010-04-12 14:49:09 +0000
@@ -374,23 +374,20 @@ return;
}
if (this.get('checked') == true) {
- // When checking the "Need review" checkbox the new
- // translation should be automatically checked.
- var select = Y.one('#' + translation_id + '_select');
- if (select !== null) {
- select.set('checked', true);
+ var new_translation_select = Y.one(
+ '#' + translation_id + '_select');
+ if (new_translation_select !== null) {
+ new_translation_select.set('checked', true); }
} 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.get('value') == '') {
- var current_radio_id = translation_id.replace(
+ var new_translation_field = Y.one('#' + translation_id);
+ if (new_translation_field !== null &&
+ new_translation_field.get('value') == '') {
+ var current_select_id = translation_id.replace( /_new$/, '_radiobutton');
- var current_radio = Y.one('#' + current_radio_id);
- if (current_radio !== null) {
- current_radio.set('checked', true);
+ var current_select = Y.one('#' + current_select_id);
+ if (current_select !== null) {
+ current_select.set('checked', true); } }
}
=== modified file 'lib/lp/translations/windmill/tests/test_pofile_translate.py'
--- lib/lp/translations/windmill/tests/test_pofile_translate.py 2010-04-12 00:39:34 +0000
+++ lib/lp/translations/windmill/tests/test_pofile_translate.py 2010-04-12 14:37:32 +0000
@@ -51,7 +51,7 @@
# Check that the associated radio button is selected. client.asserts.assertChecked(id=radiobutton_id)
- def _check_reset_translation_select(
+ def _checkResetTranslationSelect(
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
@@ -137,7 +137,29 @@ 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(
+ self._checkResetTranslationSelect(
+ client,
+ checkbox=checkbox,
+ 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 pt_BR translation with plural forms.
+ # pt_BR is a language code using the same delimiter as HTTP form
+ # fields and are prone to errors.
+ self.client.open(
+ url='http://translations.launchpad.dev:8085/'
+ 'ubuntu/hoary/+source/evolution/+pots/'
+ 'evolution-2.2/pt_BR/15/+translate')
+ self.client.waits.forPageLoad(timeout=constants.PAGE_LOAD)
+
+ checkbox = u'msgset_144_force_suggestion'
+ singular_new_select = u'msgset_144_pt_BR_translation_0_new_select'
+ singular_new_field = u'msgset_144_pt_BR_translation_0_new'
+ singular_current_select = u'msgset_144_pt_BR_translation_0_radiobutton'
+ plural_new_select = u'msgset_144_pt_BR_translation_1_new_select'
+ self._checkResetTranslationSelect( client, checkbox=checkbox, singular_new_select=singular_new_select,
@@ -151,12 +173,11 @@ 'ubuntu/hoary/+source/evolution/+pots/' 'evolution-2.2/es/19/+translate') self.client.waits.forPageLoad(timeout=constants.PAGE_LOAD)
- user.ensure_login(self.client)
I have renamed the method.
I have also added a test for pt_BR, since the use of „_” in language code and as a separator for form fields can generated errors.
I have removed „user.ensure_ login(self. client) ” and leave it only of the first page loaded in this test.
Do we really need to call it after each page load?
I have renamed the variables and remove the comment. Many thanks for this review!
=== modified file 'lib/canonical/ launchpad/ javascript/ translations/ pofile. js' launchpad/ javascript/ translations/ pofile. js 2010-04-12 00:39:34 +0000 launchpad/ javascript/ translations/ pofile. js 2010-04-12 14:49:09 +0000
return; 'checked' ) == true) { set('checked' , true); _select = Y.one( n_select !== null) { _select. set('checked' , true);
} get('value' ) == '') { id.replace( _field = Y.one('#' + translation_id); n_field !== null && _field. get('value' ) == '') { id.replace(
/_new$/ , '_radiobutton'); radio.set( 'checked' , true); select. set('checked' , true);
}
}
--- lib/canonical/
+++ lib/canonical/
@@ -374,23 +374,20 @@
}
if (this.get(
- // When checking the "Need review" checkbox the new
- // translation should be automatically checked.
- var select = Y.one('#' + translation_id + '_select');
- if (select !== null) {
- select.
+ var new_translation
+ '#' + translation_id + '_select');
+ if (new_translatio
+ new_translation
} 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_
+ var new_translation
+ if (new_translatio
+ new_translation
+ var current_select_id = translation_
- var current_radio = Y.one('#' + current_radio_id);
- if (current_radio !== null) {
- current_
+ var current_select = Y.one('#' + current_select_id);
+ if (current_select !== null) {
+ current_
}
=== modified file 'lib/lp/ translations/ windmill/ tests/test_ pofile_ translate. py' translations/ windmill/ tests/test_ pofile_ translate. py 2010-04-12 00:39:34 +0000 translations/ windmill/ tests/test_ pofile_ translate. py 2010-04-12 14:37:32 +0000
client. asserts. assertChecked( id=radiobutton_ id)
--- lib/lp/
+++ lib/lp/
@@ -51,7 +51,7 @@
# Check that the associated radio button is selected.
- def _check_ reset_translati on_select( slationSelect( new_select, singular_ current_ select,
singular_ new_field= None, plural_ new_select= None):
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' reset_translati on_select( tTranslationSel ect( new_select= singular_ new_select, new_field= singular_ new_field, current_ select= singular_ current_ select, new_select= plural_ new_select) translations. launchpad. dev:8085/ ' hoary/+ source/ evolution/ +pots/' 2.2/pt_ BR/15/+ translate' ) waits.forPageLo ad(timeout= constants. PAGE_LOAD) 144_force_ suggestion' 144_pt_ BR_translation_ 0_new_select' 144_pt_ BR_translation_ 0_new' current_ select = u'msgset_ 144_pt_ BR_translation_ 0_radiobutton' 144_pt_ BR_translation_ 1_new_select' tTranslationSel ect(
client,
checkbox= checkbox,
singular_ new_select= singular_ new_select,
'ubuntu/ hoary/+ source/ evolution/ +pots/'
'evolution- 2.2/es/ 19/+translate' )
self. client. waits.forPageLo ad(timeout= constants. PAGE_LOAD) login(self. client)
+ def _checkResetTran
self, client, checkbox, singular_
"""Checks that the new translation select radio buttons are checked
@@ -137,7 +137,29 @@
- self._check_
+ self._checkRese
+ client,
+ checkbox=checkbox,
+ singular_
+ singular_
+ singular_
+ plural_
+
+ # Go to the zoom in page for a pt_BR translation with plural forms.
+ # pt_BR is a language code using the same delimiter as HTTP form
+ # fields and are prone to errors.
+ self.client.open(
+ url='http://
+ 'ubuntu/
+ 'evolution-
+ self.client.
+
+ checkbox = u'msgset_
+ singular_new_select = u'msgset_
+ singular_new_field = u'msgset_
+ singular_
+ plural_new_select = u'msgset_
+ self._checkRese
@@ -151,12 +173,11 @@
- user.ensure_
checkbox = u'msgset_ 148_force_ suggestion'
singular_ new_select = u'msgset_ 148_es_ translation_ 0_new_select'
singular_ current_ select = u'msgset_ 148_es_ translation_ 0_radiobutton' reset_translati on_select( tTranslationSel ect(
client,
checkbox= checkbox,
singular_ new_select= singular_ new_select,
'ubuntu/ hoary/+ source/ evolution/ +pots/'
'evolution- 2.2/es/ +translate' )
self. client. waits.forPageLo ad(timeout= constants. PAGE_LOAD) login(self. client)
- self._check_
+ self._checkRese
@@ -168,12 +189,11 @@
- user.ensure_
checkbox = u'msgset_ 130_force_ suggestion'
singular_ new_select = u'msgset_ 130_es_ translation_ 0_new_select'
singular_ current_ select = u'msgset_ 130_es_ translation_ 0_radiobutton' reset_translati on_select( tTranslationSel ect(
client,
checkbox= checkbox,
singular_ new_select= singular_ new_select,
- self._check_
+ self._checkRese