You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by hn...@apache.org on 2017/11/24 10:26:03 UTC

[myfaces-tobago] 01/02: improve tests * label and markups are test for labelLayout="x"

This is an automated email from the ASF dual-hosted git repository.

hnoeth pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git

commit 47766431899f33645da557d29fe90432341b324a
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Fri Nov 24 11:24:14 2017 +0100

    improve tests
    * label and markups are test for labelLayout="x"
---
 .../100-id-markup/id-markup.test.js                | 65 ++++++++++++++++------
 1 file changed, 48 insertions(+), 17 deletions(-)

diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4800-labelLayout/100-id-markup/id-markup.test.js b/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4800-labelLayout/100-id-markup/id-markup.test.js
index 1e1ba72..d45a7a2 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4800-labelLayout/100-id-markup/id-markup.test.js
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/40-test/4800-labelLayout/100-id-markup/id-markup.test.js
@@ -16,7 +16,7 @@
  */
 
 QUnit.test("No label set", function (assert) {
-  assert.expect(3);
+  assert.expect(5);
 
   var $section = jQueryFrame("#page\\:mainForm\\:sectionNoLabel");
   var $rootDiv = $section.find(".tobago-section-content > div");
@@ -24,15 +24,15 @@ QUnit.test("No label set", function (assert) {
   var $input = $rootDiv.find("input");
 
   assert.equal($rootDiv.attr('id'), "page:mainForm:inNoLabel");
-  // TODO test label and markups
-  // assert.equal(jQuery.parseJSON($rootDiv.attr('data-tobago-markup'))[0], "testmarkup");
-  // assert.equal($label.length, 0);
+  assert.equal($label.length, 0);
   assert.equal($input.attr('id'), "page:mainForm:inNoLabel::field");
   assert.equal($input.attr('name'), "page:mainForm:inNoLabel");
+
+  assert.equal(jQuery.parseJSON($rootDiv.attr('data-tobago-markup'))[0], "testmarkup");
 });
 
 QUnit.test("labelLayout=none", function (assert) {
-  assert.expect(3);
+  assert.expect(5);
 
   var $section = jQueryFrame("#page\\:mainForm\\:sectionNone");
   var $rootDiv = $section.find(".tobago-section-content > div");
@@ -40,23 +40,28 @@ QUnit.test("labelLayout=none", function (assert) {
   var $input = $rootDiv.find("input");
 
   assert.equal($rootDiv.attr('id'), "page:mainForm:inNone");
-  // assert.equal(jQuery.parseJSON($rootDiv.attr('data-tobago-markup'))[0], "testmarkup");
-  // assert.equal($label.length, 0);
+  assert.equal($label.length, 0);
   assert.equal($input.attr('id'), "page:mainForm:inNone::field");
   assert.equal($input.attr('name'), "page:mainForm:inNone");
+
+  assert.equal(jQuery.parseJSON($rootDiv.attr('data-tobago-markup'))[0], "testmarkup");
 });
 
 QUnit.test("labelLayout=skip", function (assert) {
-  assert.expect(1);
+  assert.expect(3);
 
   var $section = jQueryFrame("#page\\:mainForm\\:sectionSkip");
   var $rootInput = $section.find(".tobago-section-content > input");
+  var $label = $section.find("label");
 
+  assert.equal($label.length, 0);
   assert.equal($rootInput.attr('id'), "page:mainForm:inSkip");
+
+  assert.equal(jQuery.parseJSON($rootInput.attr('data-tobago-markup'))[0], "testmarkup");
 });
 
 QUnit.test("labelLayout=top", function (assert) {
-  assert.expect(3);
+  assert.expect(5);
 
   var $section = jQueryFrame("#page\\:mainForm\\:sectionTop");
   var $rootDiv = $section.find(".tobago-section-content > div");
@@ -64,14 +69,15 @@ QUnit.test("labelLayout=top", function (assert) {
   var $input = $rootDiv.find("input");
 
   assert.equal($rootDiv.attr('id'), "page:mainForm:inTop");
-  // assert.equal(jQuery.parseJSON($rootDiv.attr('data-tobago-markup'))[0], "testmarkup");
-  // assert.equal($label.length, 0);
+  assert.equal($label.attr('for'), "page:mainForm:inTop::field");
   assert.equal($input.attr('id'), "page:mainForm:inTop::field");
   assert.equal($input.attr('name'), "page:mainForm:inTop");
+
+  assert.equal(jQuery.parseJSON($rootDiv.attr('data-tobago-markup'))[0], "testmarkup");
 });
 
 QUnit.test("labelLayout=flowLeft", function (assert) {
-  assert.expect(3);
+  assert.expect(5);
 
   var $section = jQueryFrame("#page\\:mainForm\\:sectionFlowLeft");
   var $rootDiv = $section.find(".tobago-section-content > div");
@@ -79,12 +85,15 @@ QUnit.test("labelLayout=flowLeft", function (assert) {
   var $input = $rootDiv.find("input");
 
   assert.equal($rootDiv.attr('id'), "page:mainForm:inFlowLeft");
+  assert.equal($label.attr('for'), "page:mainForm:inFlowLeft::field");
   assert.equal($input.attr('id'), "page:mainForm:inFlowLeft::field");
   assert.equal($input.attr('name'), "page:mainForm:inFlowLeft");
+
+  assert.equal(jQuery.parseJSON($rootDiv.attr('data-tobago-markup'))[0], "testmarkup");
 });
 
 QUnit.test("labelLayout=flowRight", function (assert) {
-  assert.expect(3);
+  assert.expect(5);
 
   var $section = jQueryFrame("#page\\:mainForm\\:sectionFlowRight");
   var $rootDiv = $section.find(".tobago-section-content > div");
@@ -92,12 +101,15 @@ QUnit.test("labelLayout=flowRight", function (assert) {
   var $input = $rootDiv.find("input");
 
   assert.equal($rootDiv.attr('id'), "page:mainForm:inFlowRight");
+  assert.equal($label.attr('for'), "page:mainForm:inFlowRight::field");
   assert.equal($input.attr('id'), "page:mainForm:inFlowRight::field");
   assert.equal($input.attr('name'), "page:mainForm:inFlowRight");
+
+  assert.equal(jQuery.parseJSON($rootDiv.attr('data-tobago-markup'))[0], "testmarkup");
 });
 
 QUnit.test("labelLayout=flexLeft", function (assert) {
-  assert.expect(3);
+  assert.expect(5);
 
   var $section = jQueryFrame("#page\\:mainForm\\:sectionFlexLeft");
   var $rootDiv = $section.find(".tobago-section-content > div");
@@ -105,12 +117,15 @@ QUnit.test("labelLayout=flexLeft", function (assert) {
   var $input = $rootDiv.find("input");
 
   assert.equal($rootDiv.attr('id'), "page:mainForm:inFlexLeft");
+  assert.equal($label.attr('for'), "page:mainForm:inFlexLeft::field");
   assert.equal($input.attr('id'), "page:mainForm:inFlexLeft::field");
   assert.equal($input.attr('name'), "page:mainForm:inFlexLeft");
+
+  assert.equal(jQuery.parseJSON($rootDiv.attr('data-tobago-markup'))[0], "testmarkup");
 });
 
 QUnit.test("labelLayout=flexRight", function (assert) {
-  assert.expect(3);
+  assert.expect(5);
 
   var $section = jQueryFrame("#page\\:mainForm\\:sectionFlexRight");
   var $rootDiv = $section.find(".tobago-section-content > div");
@@ -118,12 +133,15 @@ QUnit.test("labelLayout=flexRight", function (assert) {
   var $input = $rootDiv.find("input");
 
   assert.equal($rootDiv.attr('id'), "page:mainForm:inFlexRight");
+  assert.equal($label.attr('for'), "page:mainForm:inFlexRight::field");
   assert.equal($input.attr('id'), "page:mainForm:inFlexRight::field");
   assert.equal($input.attr('name'), "page:mainForm:inFlexRight");
+
+  assert.equal(jQuery.parseJSON($rootDiv.attr('data-tobago-markup'))[0], "testmarkup");
 });
 
 QUnit.test("labelLayout=segmentLeft", function (assert) {
-  assert.expect(5);
+  assert.expect(7);
 
   var $section = jQueryFrame("#page\\:mainForm\\:sectionSegmentLeft");
   var $segmentLayout = $section.find(".tobago-section-content > div");
@@ -137,10 +155,13 @@ QUnit.test("labelLayout=segmentLeft", function (assert) {
   assert.equal($inputSegment.attr('id'), "page:mainForm:inSegmentLeft");
   assert.equal($input.attr('id'), "page:mainForm:inSegmentLeft::field");
   assert.equal($input.attr('name'), "page:mainForm:inSegmentLeft");
+
+  assert.equal(jQuery.parseJSON($labelSegment.attr('data-tobago-markup'))[0], "testmarkup");
+  assert.equal(jQuery.parseJSON($inputSegment.attr('data-tobago-markup'))[0], "testmarkup");
 });
 
 QUnit.test("labelLayout=segmentRight", function (assert) {
-  assert.expect(5);
+  assert.expect(7);
 
   var $section = jQueryFrame("#page\\:mainForm\\:sectionSegmentRight");
   var $segmentLayout = $section.find(".tobago-section-content > div");
@@ -154,4 +175,14 @@ QUnit.test("labelLayout=segmentRight", function (assert) {
   assert.equal($inputSegment.attr('id'), "page:mainForm:inSegmentRight");
   assert.equal($input.attr('id'), "page:mainForm:inSegmentRight::field");
   assert.equal($input.attr('name'), "page:mainForm:inSegmentRight");
+
+  assert.equal(jQuery.parseJSON($labelSegment.attr('data-tobago-markup'))[0], "testmarkup");
+  assert.equal(jQuery.parseJSON($inputSegment.attr('data-tobago-markup'))[0], "testmarkup");
+});
+
+QUnit.test("Number of data-tobago-markup attributes", function (assert) {
+  assert.expect(1);
+
+  var $dataTobagoMarkups = jQueryFrame("#page\\:content .tobago-section-content [data-tobago-markup]");
+  assert.equal($dataTobagoMarkups.length, 12, "Two for segment layout components, one for all other components");
 });

-- 
To stop receiving notification emails like this one, please contact
"commits@myfaces.apache.org" <co...@myfaces.apache.org>.