From 78712605b55b767e220ea871eb74ae2ae2e273fe Mon Sep 17 00:00:00 2001 From: Adam Silverstein Date: Thu, 11 Jan 2018 20:06:38 -0500 Subject: [PATCH 01/56] amp-mathml based on amp-gist: first pass --- extensions/amp-mathml/0.1/amp-mathml.js | 110 ++++++++++++++++++ .../amp-mathml/0.1/test/test-amp-mathml.js | 64 ++++++++++ extensions/amp-mathml/OWNERS.yaml | 1 + extensions/amp-mathml/amp-mathml.md | 86 ++++++++++++++ .../validator-amp-mathml.protoascii | 40 +++++++ package.json | 1 + yarn.lock | 73 +++++++++++- 7 files changed, 369 insertions(+), 6 deletions(-) create mode 100644 extensions/amp-mathml/0.1/amp-mathml.js create mode 100644 extensions/amp-mathml/0.1/test/test-amp-mathml.js create mode 100644 extensions/amp-mathml/OWNERS.yaml create mode 100644 extensions/amp-mathml/amp-mathml.md create mode 100644 extensions/amp-mathml/validator-amp-mathml.protoascii diff --git a/extensions/amp-mathml/0.1/amp-mathml.js b/extensions/amp-mathml/0.1/amp-mathml.js new file mode 100644 index 000000000000..595f4c3d14a1 --- /dev/null +++ b/extensions/amp-mathml/0.1/amp-mathml.js @@ -0,0 +1,110 @@ +/** + * Copyright 2017 The AMP HTML Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS-IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @fileoverview Embeds a Github gist + * + * Example: + * + * + * + * + */ + +import {getIframe} from '../../../src/3p-frame'; +import {listenFor} from '../../../src/iframe-helper'; +import {removeElement} from '../../../src/dom'; +import {Layout} from '../../../src/layout'; +import {mjAPI} from 'mathjax-node'; +export class AmpMathML extends AMP.BaseElement { + + /** @param {!AmpElement} element */ + constructor(element) { + super(element); + + /** @private {?HTMLIFrameElement} */ + this.iframe_ = null; + } + + /** + * @param {boolean=} opt_onLayout + * @override + */ + preconnectCallback(opt_onLayout) { + } + + /** + * Create the actual image element and set up instance variables. + * Called lazily in the first `#layoutCallback`. + */ + initialize_ () { + if ( this.img_ ) { + return; + } + mjAPI.config( { + MathJax: { + // traditional MathJax configuration + } + } ); + mjAPI.start(); + mjAPI.typeset( { + math: this.element.getAttribute('formula'), + format: "MathML" + mml: true, // + svg: true, + }, function ( data ) { + if (!data.errors) { + this.img_ = data.svg; + this.element.appendChild( this.img_ ); + } + } ); + } + + /** @override */ + isLayoutSupported(layout) { + return layout == Layout.FIXED_HEIGHT; + } + + /** @override */ + layoutCallback() { + const iframe = getIframe(this.win, this.element); + this.applyFillContent(iframe); + // Triggered by window.context.requestResize() inside the iframe. + listenFor(iframe, 'embed-size', data => { + this./*OK*/changeHeight(data['height']); + }, /* opt_is3P */true); + + this.element.appendChild(iframe); + this.iframe_ = iframe; + return this.loadPromise(iframe); + } + + unlayoutCallback() { + if (this.iframe_) { + removeElement(this.iframe_); + this.iframe_ = null; + } + return true; + } +} + + +AMP.extension('amp-mathml', '0.1', AMP => { + AMP.registerElement('amp-mathml', AmpMathML); +}); diff --git a/extensions/amp-mathml/0.1/test/test-amp-mathml.js b/extensions/amp-mathml/0.1/test/test-amp-mathml.js new file mode 100644 index 000000000000..771fb7e7f644 --- /dev/null +++ b/extensions/amp-mathml/0.1/test/test-amp-mathml.js @@ -0,0 +1,64 @@ +/** + * Copyright 2017 The AMP HTML Authors. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS-IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import '../amp-mathml'; + + +describes.realWin('amp-mathml', { + amp: { + extensions: ['amp-mathml'], + }, +}, env => { + let win, doc; + + beforeEach(() => { + win = env.win; + doc = win.document; + }); + + function getIns(formula, file) { + const ins = doc.createElement('amp-mathml'); + ins.setAttribute('data-formula', formula); + ins.setAttribute('height', '237'); + if (file) { + ins.setAttribute('data-file', file); + } + doc.body.appendChild(ins); + return ins.build().then(() => ins.layoutCallback()).then(() => ins); + } + + it('renders responsively', () => { + return getIns('b9bb35bc68df68259af94430f012425f').then(ins => { + const iframe = ins.querySelector('iframe'); + expect(iframe).to.not.be.null; + expect(iframe.className).to.match(/i-amphtml-fill-content/); + }); + }); + + it('renders responsively with specific file', () => { + return getIns('b9bb35bc68df68259af94430f012425f', 'hello-world.html') + .then(ins => { + const iframe = ins.querySelector('iframe'); + expect(iframe).to.not.be.null; + expect(iframe.className).to.match(/i-amphtml-fill-content/); + }); + }); + + it('Rejects because data-formula is missing', () => { + expect(getIns('')).to.be.rejectedWith( + /The data-formula attribute is required for/); + }); +}); diff --git a/extensions/amp-mathml/OWNERS.yaml b/extensions/amp-mathml/OWNERS.yaml new file mode 100644 index 000000000000..842398613914 --- /dev/null +++ b/extensions/amp-mathml/OWNERS.yaml @@ -0,0 +1 @@ +- adamsilverstein \ No newline at end of file diff --git a/extensions/amp-mathml/amp-mathml.md b/extensions/amp-mathml/amp-mathml.md new file mode 100644 index 000000000000..1b053ae425df --- /dev/null +++ b/extensions/amp-mathml/amp-mathml.md @@ -0,0 +1,86 @@ + + +# `amp-mathml` + + + + + + + + + + + + + + + + + + +
DescriptionDisplays a Math.
Required Script<script async custom-element="amp-mathml" src="https://cdn.ampproject.org/v0/amp-mathml-0.1.js"></script>
Supported Layoutsfixed-height
ExamplesAnnotated code example for amp-mathml
+ +[TOC] + +## Behavior + +This extension creates an iframe and displays a [gist from GitHub](https://help.github.com/articles/about-gists/). + +#### Example: Embedding multiple files + +```html + + +``` + +#### Example: Embedding a single file + +```html + + +``` + +## Attributes + +##### data-gistid (required) + +The ID of the gist to embed. + +##### layout (required) + +Currently only supports `fixed-height`. + +##### height (required) + +The height of the gist or gist file in pixels. + +**Note**: You must find the height of the gist by inspecting it with your browser (e.g., Chrome Developer Tools). + +##### data-file (optional) + +If specified, display only one file in a gist. + +## Validation +See [amp-mathml rules](https://github.com/ampproject/amphtml/blob/master/extensions/amp-mathml/validator-amp-gist.protoascii) in the AMP validator specification. diff --git a/extensions/amp-mathml/validator-amp-mathml.protoascii b/extensions/amp-mathml/validator-amp-mathml.protoascii new file mode 100644 index 000000000000..18cf98b248da --- /dev/null +++ b/extensions/amp-mathml/validator-amp-mathml.protoascii @@ -0,0 +1,40 @@ +# +# Copyright 2017 The AMP HTML Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS-IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the license. +# + +tags: { # amp-mathml + html_format: AMP + tag_name: "SCRIPT" + extension_spec: { + name: "amp-mathml" + allowed_versions: "0.1" + allowed_versions: "latest" + } + attr_lists: "common-extension-attrs" +} +tags: { # + html_format: AMP + tag_name: "AMP-mathml" + requires_extension: "amp-mathml" + attrs: { + name: "data-formula" + mandatory: true + } + attr_lists: "extended-amp-global" + spec_url: "https://www.ampproject.org/docs/reference/components/amp-mathml" + amp_layout: { + supported_layouts: FIXED_HEIGHT + } +} diff --git a/package.json b/package.json index 5fa3a814d3ce..bbc115d847f6 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "dependencies": { "babel-polyfill": "6.26.0", "document-register-element": "1.5.0", + "mathjax-node": "^1.3.0", "promise-pjs": "1.1.3", "react-dates": "13.0.6", "web-animations-js": "2.3.1" diff --git a/yarn.lock b/yarn.lock index 0f0086ab45b6..14ed2e58d8d5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -178,6 +178,12 @@ acorn-globals@4.1.0, acorn-globals@^4.0.0: dependencies: acorn "^5.0.0" +acorn-globals@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-3.1.0.tgz#fd8270f71fbb4996b004fa880ee5d46573a731bf" + dependencies: + acorn "^4.0.4" + acorn-jsx@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-3.0.1.tgz#afdf9488fb1ecefc8348f6fb22f464e32a58b36b" @@ -192,7 +198,7 @@ acorn@^3.0.4: version "3.3.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" -acorn@^4.0.3: +acorn@^4.0.3, acorn@^4.0.4: version "4.0.13" resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.13.tgz#105495ae5361d697bd195c825192e1ad7f253787" @@ -3395,7 +3401,7 @@ escodegen@1.8.x: optionalDependencies: source-map "~0.2.0" -escodegen@1.9.0, escodegen@1.x.x, escodegen@^1.9.0: +escodegen@1.9.0, escodegen@1.x.x, escodegen@^1.6.1, escodegen@^1.9.0: version "1.9.0" resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.9.0.tgz#9811a2f265dc1cd3894420ee3717064b632b8852" dependencies: @@ -5803,6 +5809,30 @@ jsdom@11.5.1: whatwg-url "^6.3.0" xml-name-validator "^2.0.1" +"jsdom@7.0 - 9.12": + version "9.12.0" + resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-9.12.0.tgz#e8c546fffcb06c00d4833ca84410fed7f8a097d4" + dependencies: + abab "^1.0.3" + acorn "^4.0.4" + acorn-globals "^3.1.0" + array-equal "^1.0.0" + content-type-parser "^1.0.1" + cssom ">= 0.3.2 < 0.4.0" + cssstyle ">= 0.2.37 < 0.3.0" + escodegen "^1.6.1" + html-encoding-sniffer "^1.0.1" + nwmatcher ">= 1.3.9 < 2.0.0" + parse5 "^1.5.1" + request "^2.79.0" + sax "^1.2.1" + symbol-tree "^3.2.1" + tough-cookie "^2.3.2" + webidl-conversions "^4.0.0" + whatwg-encoding "^1.0.1" + whatwg-url "^4.3.0" + xml-name-validator "^2.0.1" + jsesc@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-1.3.0.tgz#46c3fec8c1892b12b0833db9bc7622176dbab34b" @@ -6683,6 +6713,18 @@ matcher@^1.0.0: dependencies: escape-string-regexp "^1.0.4" +mathjax-node@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/mathjax-node/-/mathjax-node-1.3.0.tgz#a58c90a185d909b6323b19c0db1501d14ac0070c" + dependencies: + is-fullwidth-code-point "^2.0.0" + jsdom "7.0 - 9.12" + mathjax "^2.7.2" + +mathjax@^2.7.2: + version "2.7.2" + resolved "https://registry.yarnpkg.com/mathjax/-/mathjax-2.7.2.tgz#97d78bbebfb65a8621ce33fb7c1f10917355a878" + md5-hex@^1.2.0, md5-hex@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/md5-hex/-/md5-hex-1.3.0.tgz#d2c4afe983c4370662179b8cad145219135046c4" @@ -7270,7 +7312,7 @@ number-is-nan@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" -nwmatcher@^1.4.3: +"nwmatcher@>= 1.3.9 < 2.0.0", nwmatcher@^1.4.3: version "1.4.3" resolved "https://registry.yarnpkg.com/nwmatcher/-/nwmatcher-1.4.3.tgz#64348e3b3d80f035b40ac11563d278f8b72db89c" @@ -7612,6 +7654,10 @@ parse-passwd@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/parse-passwd/-/parse-passwd-1.0.0.tgz#6d5b934a456993b23d37f40a382d6f1666a8e5c6" +parse5@^1.5.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/parse5/-/parse5-1.5.1.tgz#9b7f3b0de32be78dc2401b17573ccaf0f6f59d94" + parse5@^3.0.2: version "3.0.3" resolved "https://registry.yarnpkg.com/parse5/-/parse5-3.0.3.tgz#042f792ffdd36851551cf4e9e066b3874ab45b5c" @@ -8819,7 +8865,7 @@ request@2.81.0: tunnel-agent "^0.6.0" uuid "^3.0.0" -request@2.83.0, request@^2.0.0, request@^2.74.0, request@^2.83.0: +request@2.83.0, request@^2.0.0, request@^2.74.0, request@^2.79.0, request@^2.83.0: version "2.83.0" resolved "https://registry.yarnpkg.com/request/-/request-2.83.0.tgz#ca0b65da02ed62935887808e6f510381034e3356" dependencies: @@ -10062,7 +10108,7 @@ touch@3.1.0, touch@^3.1.0: dependencies: nopt "~1.0.10" -tough-cookie@>=2.3.3, tough-cookie@^2.3.3, tough-cookie@~2.3.0, tough-cookie@~2.3.3: +tough-cookie@>=2.3.3, tough-cookie@^2.3.2, tough-cookie@^2.3.3, tough-cookie@~2.3.0, tough-cookie@~2.3.3: version "2.3.3" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.3.tgz#0b618a5565b6dea90bf3425d04d55edc475a7561" dependencies: @@ -10074,6 +10120,10 @@ tr46@^1.0.0: dependencies: punycode "^2.1.0" +tr46@~0.0.3: + version "0.0.3" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" + trim-newlines@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-1.0.0.tgz#5887966bb582a4503a41eb524f7d35011815a613" @@ -10567,7 +10617,11 @@ web-animations-js@2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/web-animations-js/-/web-animations-js-2.3.1.tgz#3a6d9bc15196377a90f8e2803fa5262165b04510" -webidl-conversions@^4.0.1, webidl-conversions@^4.0.2: +webidl-conversions@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" + +webidl-conversions@^4.0.0, webidl-conversions@^4.0.1, webidl-conversions@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad" @@ -10596,6 +10650,13 @@ whatwg-fetch@>=0.10.0: version "2.0.3" resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.3.tgz#9c84ec2dcf68187ff00bc64e1274b442176e1c84" +whatwg-url@^4.3.0: + version "4.8.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-4.8.0.tgz#d2981aa9148c1e00a41c5a6131166ab4683bbcc0" + dependencies: + tr46 "~0.0.3" + webidl-conversions "^3.0.0" + whatwg-url@^6.3.0: version "6.4.0" resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-6.4.0.tgz#08fdf2b9e872783a7a1f6216260a1d66cc722e08" From 4197b1c15f36e4c2416d98c3332ea915a7086dd4 Mon Sep 17 00:00:00 2001 From: Adam Silverstein Date: Fri, 12 Jan 2018 14:12:24 -0500 Subject: [PATCH 02/56] update first pass --- examples/amp-mathml.amp.html | 28 +++++ extensions/amp-mathml/0.1/amp-mathml.js | 100 +++++------------- .../amp-mathml/0.1/test/test-amp-mathml.js | 48 ++------- extensions/amp-mathml/OWNERS.yaml | 1 - extensions/amp-mathml/amp-mathml.md | 59 +++-------- .../validator-amp-mathml.protoascii | 57 +++++++--- gulpfile.js | 1 + package.json | 2 +- .../testdata/feature_tests/amp-mathml.html | 27 +++++ 9 files changed, 151 insertions(+), 172 deletions(-) create mode 100644 examples/amp-mathml.amp.html delete mode 100644 extensions/amp-mathml/OWNERS.yaml create mode 100644 validator/testdata/feature_tests/amp-mathml.html diff --git a/examples/amp-mathml.amp.html b/examples/amp-mathml.amp.html new file mode 100644 index 000000000000..3a798a8a2634 --- /dev/null +++ b/examples/amp-mathml.amp.html @@ -0,0 +1,28 @@ + + + + + amp-mathml example + + + + + + + + +

The Quadratic Formula

+ + +

Cauchy's Integral Formula

+ + +

Double angle formula for Cosines

+ + + + diff --git a/extensions/amp-mathml/0.1/amp-mathml.js b/extensions/amp-mathml/0.1/amp-mathml.js index 595f4c3d14a1..da9d13195959 100644 --- a/extensions/amp-mathml/0.1/amp-mathml.js +++ b/extensions/amp-mathml/0.1/amp-mathml.js @@ -1,5 +1,5 @@ /** - * Copyright 2017 The AMP HTML Authors. All Rights Reserved. + * Copyright 2018 The AMP HTML Authors. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,97 +14,53 @@ * limitations under the License. */ -/** - * @fileoverview Embeds a Github gist - * - * Example: - * - * - * - * - */ - -import {getIframe} from '../../../src/3p-frame'; -import {listenFor} from '../../../src/iframe-helper'; -import {removeElement} from '../../../src/dom'; import {Layout} from '../../../src/layout'; -import {mjAPI} from 'mathjax-node'; -export class AmpMathML extends AMP.BaseElement { +import {cssstyle} from 'cssstyle'; +import {mathjaxNode} from 'mathjax-node'; + +export class AmpMathml extends AMP.BaseElement { /** @param {!AmpElement} element */ constructor(element) { super(element); - /** @private {?HTMLIFrameElement} */ - this.iframe_ = null; - } + /** @private {string} */ + this.myText_ = 'hello world!!'; - /** - * @param {boolean=} opt_onLayout - * @override - */ - preconnectCallback(opt_onLayout) { + /** @private {!Element} */ + this.container_ = this.win.document.createElement('div'); } - /** - * Create the actual image element and set up instance variables. - * Called lazily in the first `#layoutCallback`. - */ - initialize_ () { - if ( this.img_ ) { + /** @override */ + buildCallback() { + const formula = this.element.getAttribute( 'formula' ); + if(! formula || '' === formula){ return; } - mjAPI.config( { - MathJax: { - // traditional MathJax configuration - } - } ); - mjAPI.start(); - mjAPI.typeset( { - math: this.element.getAttribute('formula'), - format: "MathML" - mml: true, // + console.log( mathjaxNode.typeset ); + mathjaxNode.typeset( { + math: this.element.getAttribute( 'formula' ), + format: "MathML", + mml: true, svg: true, }, function ( data ) { - if (!data.errors) { + console.log( data ); + if ( !data.errors ) { this.img_ = data.svg; this.element.appendChild( this.img_ ); - } + } } ); - } - /** @override */ - isLayoutSupported(layout) { - return layout == Layout.FIXED_HEIGHT; - } + this.container_.textContent = this.myText_ + this.element.getAttribute( 'formula' ); + this.element.appendChild( this.container_ ); + this.applyFillContent( this.container_, /* replacedContent */ true ); + } /** @override */ - layoutCallback() { - const iframe = getIframe(this.win, this.element); - this.applyFillContent(iframe); - // Triggered by window.context.requestResize() inside the iframe. - listenFor(iframe, 'embed-size', data => { - this./*OK*/changeHeight(data['height']); - }, /* opt_is3P */true); - - this.element.appendChild(iframe); - this.iframe_ = iframe; - return this.loadPromise(iframe); - } - - unlayoutCallback() { - if (this.iframe_) { - removeElement(this.iframe_); - this.iframe_ = null; - } - return true; + isLayoutSupported(layout) { + return layout == Layout.CONTAINER; } } -AMP.extension('amp-mathml', '0.1', AMP => { - AMP.registerElement('amp-mathml', AmpMathML); -}); +AMP.registerElement('amp-mathml', AmpMathml); diff --git a/extensions/amp-mathml/0.1/test/test-amp-mathml.js b/extensions/amp-mathml/0.1/test/test-amp-mathml.js index 771fb7e7f644..98ff8418cf12 100644 --- a/extensions/amp-mathml/0.1/test/test-amp-mathml.js +++ b/extensions/amp-mathml/0.1/test/test-amp-mathml.js @@ -1,5 +1,5 @@ /** - * Copyright 2017 The AMP HTML Authors. All Rights Reserved. + * Copyright 2018 The AMP HTML Authors. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,51 +14,25 @@ * limitations under the License. */ -import '../amp-mathml'; - +import {AmpMathml} from '../amp-mathml'; describes.realWin('amp-mathml', { amp: { extensions: ['amp-mathml'], - }, + } }, env => { - let win, doc; + + let win; + let element; beforeEach(() => { win = env.win; - doc = win.document; - }); - - function getIns(formula, file) { - const ins = doc.createElement('amp-mathml'); - ins.setAttribute('data-formula', formula); - ins.setAttribute('height', '237'); - if (file) { - ins.setAttribute('data-file', file); - } - doc.body.appendChild(ins); - return ins.build().then(() => ins.layoutCallback()).then(() => ins); - } - - it('renders responsively', () => { - return getIns('b9bb35bc68df68259af94430f012425f').then(ins => { - const iframe = ins.querySelector('iframe'); - expect(iframe).to.not.be.null; - expect(iframe.className).to.match(/i-amphtml-fill-content/); - }); - }); - - it('renders responsively with specific file', () => { - return getIns('b9bb35bc68df68259af94430f012425f', 'hello-world.html') - .then(ins => { - const iframe = ins.querySelector('iframe'); - expect(iframe).to.not.be.null; - expect(iframe.className).to.match(/i-amphtml-fill-content/); - }); + element = win.document.createElement('amp-mathml'); + win.document.body.appendChild(element); }); - it('Rejects because data-formula is missing', () => { - expect(getIns('')).to.be.rejectedWith( - /The data-formula attribute is required for/); + it('should have hello world when built', () => { + element.build(); + expect(element.querySelector('div').textContent).to.equal('hello world'); }); }); diff --git a/extensions/amp-mathml/OWNERS.yaml b/extensions/amp-mathml/OWNERS.yaml deleted file mode 100644 index 842398613914..000000000000 --- a/extensions/amp-mathml/OWNERS.yaml +++ /dev/null @@ -1 +0,0 @@ -- adamsilverstein \ No newline at end of file diff --git a/extensions/amp-mathml/amp-mathml.md b/extensions/amp-mathml/amp-mathml.md index 1b053ae425df..ccbc5db0e2d1 100644 --- a/extensions/amp-mathml/amp-mathml.md +++ b/extensions/amp-mathml/amp-mathml.md @@ -1,5 +1,5 @@