Skip to content

Commit c98e254

Browse files
committed
add test for relative indicator definition
1 parent 8708fe2 commit c98e254

2 files changed

Lines changed: 51 additions & 0 deletions

File tree

test/attributes/hx-indicator.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,19 @@ describe("hx-indicator attribute", function(){
3434
a2.classList.contains("htmx-request").should.equal(false);
3535
});
3636

37+
it('Indicator classes are properly put on element with relative indicator', function()
38+
{
39+
this.server.respondWith("GET", "/test", "Clicked!");
40+
var btn = make('<button hx-get="/test" hx-indicator="next a">Click Me!</button>')
41+
var a1 = make('<a id="a1"></a>')
42+
btn.click();
43+
btn.classList.contains("htmx-request").should.equal(false);
44+
a1.classList.contains("htmx-request").should.equal(true);
45+
this.server.respond();
46+
btn.classList.contains("htmx-request").should.equal(false);
47+
a1.classList.contains("htmx-request").should.equal(false);
48+
});
49+
3750
it('Indicator classes are properly put on element with explicit indicator w/ data-* prefix', function()
3851
{
3952
this.server.respondWith("GET", "/test", "Clicked!");
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
+++
2+
title = "Different Types Of Decoupling"
3+
date = 2022-10-23
4+
updated = 2023-02-03
5+
[taxonomies]
6+
tag = ["posts"]
7+
+++
8+
9+
> The central feature that distinguishes the REST architectural style from other network-based styles is its emphasis on
10+
> a uniform interface between components. By applying the software engineering principle of generality to the component
11+
> interface, the overall system architecture is simplified and the visibility of interactions is improved.
12+
> Implementations are decoupled from the services they provide, which encourages independent evolvability.
13+
14+
_-Roy Fielding, <https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm#sec_5_1_5>_
15+
16+
Decoupling is the opposite of [coupling](https://en.wikipedia.org/wiki/Coupling_(computer_programming)), where two
17+
pieces of software have a high degree of _interdependence_. Decoupling software is the act of reducing this
18+
interdependence between unrelated modules so that they can evolve independently. The concept of coupling and decoupling
19+
is closely (and inversely) related to [cohesion](https://en.wikipedia.org/wiki/Cohesion_(computer_science)). A highly
20+
cohesive software module has related logic within a module or conceptual boundary, rather than spread out. Broadly,
21+
the more decoupled your codebase is, the more cohesive it will be as well. Developers generally have a sense that
22+
decoupling is a good thing
23+
24+
An argument we see at times for the JSON/Data API style of development, where a Single Page Application-style web
25+
applications communicates with a back end via a JSON API, is that this architectural choice _decouples_ the front-end and
26+
back-end code, and allows re-use of the JSON API in other contexts, such as a mobile application.
27+
28+
29+
30+
You can imagine how creating a general JSON Data API that can be consumed by multiple clients would _decouple_ your
31+
application's back-end code from a particular client: it provides a standard, well documented API and any client that wants
32+
to can use that is welcome to do so.
33+
34+
In the second part of this essay we are going to talk about the hypermedia approach, and how it decouples your system in
35+
a different manner than the way a generic Data API does. But, before we get into that, we want to spend a bit of time and
36+
look at the facts on the ground with respect to JSON APIs and see how decoupling is working out.
37+
38+
## "The Worst Part Of My Job..."

0 commit comments

Comments
 (0)