Skip to content

Commit

Permalink
Merge pull request #180 from sandydoo/wip/fix-canvas
Browse files Browse the repository at this point in the history
  • Loading branch information
sandydoo authored Dec 25, 2023
2 parents 548aee6 + 09245d7 commit 6566f23
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 57 deletions.
2 changes: 1 addition & 1 deletion addon/components/g-map/canvas.hbs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<div id={{@id}} class="ember-google-map" ...attributes {{g-map/did-insert @onCanvasReady}}>{{yield}}</div>
<div class="ember-google-map" ...attributes {{g-map/did-insert @onCanvasReady}}>{{yield}}</div>
42 changes: 0 additions & 42 deletions lib/ast-transforms/builders.js

This file was deleted.

23 changes: 9 additions & 14 deletions lib/ast-transforms/canvas-enforcer.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
'use-strict';

const getBuilders = require('./builders');

function enforceCanvas(env) {
let b = getBuilders(env.syntax);
let b = env.syntax.builders;

let visitor = {
BlockStatement(node) {
Expand Down Expand Up @@ -44,26 +42,23 @@ function enforceCanvas(env) {
);

let classAttr = attributes.get('class');

if (classAttr) {
classAttr.value.chars += ' ember-google-map';
attributes.set('class', classAttr);
} else {
let defaultClass = b.attr('class', b.text('ember-google-map'));
attributes.set('class', defaultClass);
}

let canvas = b.element(
{
name: `${blockParam}.canvas`,
selfClosing: true,
},
Array.from(attributes.values()),
[],
[],
undefined,
[],
node.loc
{
attrs: Array.from(attributes.values()),
modifiers: [],
children: [],
comments: undefined,
blockParams: [],
loc: node.loc,
}
);

children.unshift(canvas);
Expand Down
1 change: 1 addition & 0 deletions tests/acceptance/app-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module('Acceptance | app', function (hooks) {

test('visiting /', async function (assert) {
await visit('/');

let { components } = await waitForMap('main-map');

let marker = components.markers
Expand Down

0 comments on commit 6566f23

Please sign in to comment.