]> git.ipfire.org Git - thirdparty/bulma.git/commitdiff
Add media specs
authorJeremy Thomas <bbxdesign@gmail.com>
Fri, 5 Nov 2021 19:11:10 +0000 (19:11 +0000)
committerJeremy Thomas <bbxdesign@gmail.com>
Fri, 5 Nov 2021 19:11:10 +0000 (19:11 +0000)
docs/cyp/layout/media.html [new file with mode: 0644]
docs/cypress/integration/layout/media.spec.js [new file with mode: 0644]

diff --git a/docs/cyp/layout/media.html b/docs/cyp/layout/media.html
new file mode 100644 (file)
index 0000000..b4667db
--- /dev/null
@@ -0,0 +1,108 @@
+---
+layout: cypress
+title: Components/Media
+---
+
+<article id="media" class="media">
+  <figure class="media-left">
+    <p class="image is-64x64">
+      <img src="{{site.url}}/images/placeholders/128x128.png">
+    </p>
+  </figure>
+
+  <div class="media-content">
+    <div class="content">
+      <p>
+        <strong>John Smith</strong> <small>@johnsmith</small> <small>31m</small>
+        <br>
+        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin ornare magna eros, eu pellentesque tortor vestibulum ut. Maecenas non massa sem. Etiam finibus odio quis feugiat facilisis.
+      </p>
+    </div>
+
+    <nav class="level is-mobile">
+      <div class="level-left">
+        <a class="level-item">
+          <span class="icon is-small"><i class="fas fa-reply"></i></span>
+        </a>
+        <a class="level-item">
+          <span class="icon is-small"><i class="fas fa-retweet"></i></span>
+        </a>
+        <a class="level-item">
+          <span class="icon is-small"><i class="fas fa-heart"></i></span>
+        </a>
+      </div>
+    </nav>
+  </div>
+
+  <div class="media-right">
+    <button class="delete"></button>
+  </div>
+</article>
+
+<article id="media-nested" class="media">
+  <figure class="media-left">
+    <p class="image is-64x64">
+      <img src="{{site.url}}/images/placeholders/128x128.png">
+    </p>
+  </figure>
+
+  <div class="media-content">
+    <div class="content">
+      <p>
+        <strong>Barbara Middleton</strong>
+        <br>
+        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis porta eros lacus, nec ultricies elit blandit non. Suspendisse pellentesque mauris sit amet dolor blandit rutrum. Nunc in tempus turpis.
+        <br>
+        <small><a>Like</a> · <a>Reply</a> · 3 hrs</small>
+      </p>
+    </div>
+
+    <article class="media">
+      <figure class="media-left">
+        <p class="image is-48x48">
+          <img src="{{site.url}}/images/placeholders/96x96.png">
+        </p>
+      </figure>
+
+      <div class="media-content">
+        <div class="content">
+          <p>
+            <strong>Sean Brown</strong>
+            <br>
+            Donec sollicitudin urna eget eros malesuada sagittis. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Aliquam blandit nisl a nulla sagittis, a lobortis leo feugiat.
+            <br>
+            <small><a>Like</a> · <a>Reply</a> · 2 hrs</small>
+          </p>
+        </div>
+
+        <article class="media">
+          Vivamus quis semper metus, non tincidunt dolor. Vivamus in mi eu lorem cursus ullamcorper sit amet nec massa.
+        </article>
+
+        <article class="media">
+          Morbi vitae diam et purus tincidunt porttitor vel vitae augue. Praesent malesuada metus sed pharetra euismod. Cras tellus odio, tincidunt iaculis diam non, porta aliquet tortor.
+        </article>
+      </div>
+    </article>
+
+    <article class="media">
+      <figure class="media-left">
+        <p class="image is-48x48">
+          <img src="{{site.url}}/images/placeholders/96x96.png">
+        </p>
+      </figure>
+
+      <div class="media-content">
+        <div class="content">
+          <p>
+            <strong>Kayli Eunice </strong>
+            <br>
+            Sed convallis scelerisque mauris, non pulvinar nunc mattis vel. Maecenas varius felis sit amet magna vestibulum euismod malesuada cursus libero. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Phasellus lacinia non nisl id feugiat.
+            <br>
+            <small><a>Like</a> · <a>Reply</a> · 2 hrs</small>
+          </p>
+        </div>
+      </div>
+    </article>
+  </div>
+</article>
diff --git a/docs/cypress/integration/layout/media.spec.js b/docs/cypress/integration/layout/media.spec.js
new file mode 100644 (file)
index 0000000..27eb33a
--- /dev/null
@@ -0,0 +1,52 @@
+describe("Components/Media", () => {
+  beforeEach(() => {
+    cy.visit("http://127.0.0.1:4000/cyp/layout/media/");
+  });
+
+  it("has a Media", () => {
+    cy.get(".media").should("exist");
+  });
+
+  it("has a correct Media", () => {
+    cy.get("#media").then(($) => {
+      const cs = window.getComputedStyle($[0]);
+      expect(cs.alignItems).to.equal("flex-start");
+      expect(cs.display).to.equal("flex");
+    });
+  });
+
+  it("has a correct nested Media", () => {
+    cy.get("#media-nested .media-content .media + .media").then(($) => {
+      const cs = window.getComputedStyle($[0]);
+      expect(cs.borderTopColor).to.equal("rgba(219, 219, 219, 0.5)");
+      expect(cs.borderTopStyle).to.equal("solid");
+      expect(cs.borderTopWidth).to.equal("1px");
+      expect(cs.marginTop).to.equal("8px");
+      expect(cs.paddingTop).to.equal("8px");
+    });
+  });
+
+  it("has a correct Media Content", () => {
+    cy.get("#media .media-content").then(($) => {
+      const cs = window.getComputedStyle($[0]);
+      expect(cs.flexGrow).to.equal("1");
+      expect(cs.flexShrink).to.equal("1");
+    });
+  });
+
+  it("has correct Media Left and Right", () => {
+    cy.get("#media .media-left").then(($) => {
+      const cs = window.getComputedStyle($[0]);
+      expect(cs.flexGrow).to.equal("0");
+      expect(cs.flexShrink).to.equal("0");
+      expect(cs.marginRight).to.equal("16px");
+    });
+
+    cy.get("#media .media-right").then(($) => {
+      const cs = window.getComputedStyle($[0]);
+      expect(cs.flexGrow).to.equal("0");
+      expect(cs.flexShrink).to.equal("0");
+      expect(cs.marginLeft).to.equal("16px");
+    });
+  });
+});